Login as Root

[root@server~]# cd /var/www/html 

[root@server~]# # wget -c http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.3.7/phpMyAdmin-3.3.7-english.tar.gz/download

[root@server~]# # tar -xzvf phpMyAdmin-3.3.7-english.tar.gz

[root@server~]# # rm -rf phpMyAdmin-3.3.7-english.tar.gz

[root@server~]# # mv phpMyAdmin-3.3.7-english phpmyadmin

[root@server~]# # cd phpmyadmin

[root@server~]# # cp config.sample.inc.php config.inc.php

[root@server~]# # service httpd restart

 You can test by open phpmyadmin by this link :

http://your.domain.com/phpmyadmin/ ( Eg : http://localhost/phpmyadmin)

Try to login as a mysql user.

If you get this error

#2002 Cannot log in to the MySQL server

Solution :

Reset Mysql root password and retry after that.

 Reset Mysql Root Password

1: Stop the MySQL server process.

[root@server~]# # /etc/init.d/mysqld stop

2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.

[root@server~]# # mysqld_safe –skip-grant-tables &

3: Connect to mysql server as the root user.

[root@server~]# # mysql -u root

4: Setup new mysql root account password i.e. reset mysql password.

mysql> use mysql;

mysql> update user set password=PASSWORD(“NEW-ROOT-PASSWORD”) where User=’root’;

mysql> flush privileges;

mysql> quit;

5: Exit and restart the MySQL server.

[root@server~]#  /etc/init.d/mysqld stop

6: Start MySQL server and test it

[root@server~]# /etc/init.d/mysql start

[root@server~]#  mysql -u root -p

Login with new root password

Posted in: Linux.
Last Modified: October 24, 2013

Leave a reply