Tampilkan postingan dengan label Mysql. Tampilkan semua postingan
Tampilkan postingan dengan label Mysql. Tampilkan semua postingan
Jumat, 06 September 2013

Cara reset password mysql


Cara reset password mysql
Stop the mysql demon process using this command :
  •    sudo /etc/init.d/mysql stop


  • Start the mysqld demon process using the --skip-grant-tables option with this command 
    •    sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &

  • Because you are not checking user privs at this point, it's safest to disable networking. In Dapper, /usr/bin/mysgld... did not work. However, mysqld --skip-grant-tables did.
    • start the mysql client process using this command 
      •    mysql -u root
    • from the mysql prompt execute this command to be able to change any password
      •    FLUSH PRIVILEGES;
    • Then reset/update your password 
      •    SET PASSWORD FOR root@'localhost' = PASSWORD('password');
    • If you have a mysql root account that can connect from everywhere, you should also do:
      •    UPDATE mysql.user SET Password=PASSWORD('newpwd') WHERE User='root';
    • Alternate Method:
      •    USE mysql
           UPDATE user SET Password = PASSWORD('newpwd')
           WHERE Host = 'localhost' AND User = 'root';
    • And if you have a root account that can access from everywhere:
      •    USE mysql
           UPDATE user SET Password = PASSWORD('newpwd')
           WHERE Host = '%' AND User = 'root';
    For either method, once have received a message indicating a successful query (one or more rows affected), flush privileges:
    FLUSH PRIVILEGES;

    Then stop the mysqld process and relaunch it with the classical way:
    sudo /etc/init.d/mysql stop
    sudo /etc/init.d/mysql start

    When you have completed all this steps ,you can easily access to your mysql server with the password you have set in the step before. An easy way to have a full control of your mysql server is phpmyadmin (www.phpmyadmin.net), software made in php that can give you a web interface that can be very usefull to people that havent got a lot of confidence with bash .To install phpmyadmin on you server you will need to have 4 things:
    • web server apache
    • php 
    • mysql server/mysql client installed
    • php_mysql support for apache 
    All packages can be found browsing synaptic.

    Another way, purge


    I also had some problems with mysql just not accepting my password. I tried the other way as well and it just ended up being difficult. I had not been able to use mysql so it was empty anyway. If this is also your case you may opt for the PURGE way. This removes every file related to mysql. Depending on your installation the packages might be diffrent, mysql-server in 6.10 is called mysql-server-5.0 as an example.
     USE THIS AS A LAST RESORT METHOD, YOU WILL LOSE ALL YOUR MYSQL DATA
    sudo apt-get --purge remove mysql-server mysql-common mysql-client

    sudo apt-get install mysql-server mysql-common mysql-client

    In the next step be sure to chance the your-new-password with the password you want!
    mysqladmin -u root password your-new-password
    sudo /etc/init.d/mysql restart

    mysql -u root -p
    Sabtu, 29 September 2012

    Install Apache, PHP, MYSQL and phpMyAdmin di Ubuntu


    I will show the command and configuration to install Apache, PHP, MYSQL and phpMyAdmin in Ubuntu
    1. Installing  Apache
    • Open your terminal and type the bellow command
           #sudo apt-get install apache2
    install_apache
    • It will ask for your password, Type your ubuntu password and press  enter key, it will ask for confirmation
    confirm_install
    • Type y and press enter key
    • When installation is done, open your browser and type   http://localhost/
    • I will print it works into the browser
    2. Installing PHP
    • Open your terminal and type the bellow command
            #sudo apt-get install php5 libapache2-mod-php5
    install_php
    • It will ask for your password, Type your ubuntu password and press  enter key, it will ask for confirmation
    confirm_install
    • Type y and press enter key
    • After the successful installation restart Apache using the below command
            #sudo /etc/init.d/apache2 restart
    • Open your  /var/www/ directory  and create a php file  with any name like info.php file, write some php code into the file
    test_php_and_apache
    • When installation is done and you have to created the php file into the /var/www/ directory, open your browser and type
    • It will   execute the file, which confirm that your apache and php installation was successful
    3.  Installing MYSQL
    • Open your terminal and type the bellow command
             #sudo apt-get install mysql-server
    install_mysql
    • It will ask for your password, Type your ubuntu password and press  enter key, it will ask for confirmation
    confirm_install
    • Type y and press enter key
    • During the installation you will be prompted for a password. Choose a secure and type the password and press enter. It will also ask to re enter password
    set_mysql_password
    4. Installing phpMyAdmin
    • Open your terminal and type the bellow command
            #sudo apt-get install phpmyadmin
    install_phpmyadmin
    • It will ask for your password, Type your ubuntu password and press  enter key, it will ask for confirmation
    confirm_install
    • Type y and press enter key
    • During the installation you will be prompted for a web server configuration. Select Apache and press Enter
    select_web_server_for_phpmyadmin
    • Now you will be prompted for phpmyadmin configuration, Select no
    phpmyadmin_config_option
    • In terminal Run the bellow command
              #sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d
    • Restart your apache server
             #sudo /etc/init.d/apache2 restart
    • Open your browser and type
    Your Apache, PHP, MYSQL and phpMyAdmin is ready in Ubuntu, start your coding…..