LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Mysql root login problem (https://www.linuxquestions.org/questions/linux-newbie-8/mysql-root-login-problem-888073/)

digsecurity 06-24-2011 04:24 AM

Mysql root login problem
 
hi all,
I am having problem with mysql server in fedora14. It throws the following error whenever I try to connect with root user.
Quote:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
It shows the same error when I just press mysql. I even cant change the root password. But I am able to login with other user.

tronayne 06-24-2011 07:17 AM

If
Code:

mysql_secure_installation
was executed, "You can remove root accounts that are accessible from outside the local host."

So, if you're trying to access a remote machine, that's the problem (you can't).

Otherwise, either (1) there is no password set (so don't use -p on the command line) or (2) you don't have the correct password.

If you can connect to the mysql data base, e.g., "use mysql," try
Code:

mysql> select host, user, password from user;
and see what you get -- a system without a root password will look like this
Code:

mysql> select host, user, password from user;
+-----------+--------+-------------------------------------------+
| host      | user  | password                                  |
+-----------+--------+-------------------------------------------+
| localhost | root  |                                          |
| fubar    | root  |                                          |
| 127.0.0.1 | root  |                                          |
| localhost |        |                                          |
| fubar    |        |                                          |
| localhost | trona  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| %        | trona  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| localhost | gnis  | *810EB1988696641613BC905C437D48DB0286A594 |
| %        | gnis  | *810EB1988696641613BC905C437D48DB0286A594 |
| localhost | bugs  | *20F70E9EB731F79D181E637A46E64D7E1050F956 |
| %        | bugs  | *20F70E9EB731F79D181E637A46E64D7E1050F956 |
| localhost | ged    | *4CA8F8F4B8B5DCC12808D5AE020BCCB3E522CCA6 |
| %        | ged    | *4CA8F8F4B8B5DCC12808D5AE020BCCB3E522CCA6 |
| localhost | ipplan | *EDA2B4CA7C3B7D3287C8DB2EA4850DFB25D9ED41 |
| %        | ipplan | *EDA2B4CA7C3B7D3287C8DB2EA4850DFB25D9ED41 |
+-----------+--------+-------------------------------------------+
15 rows in set (0.00 sec)

whereas a system with a root password will look like this
Code:

mysql> select host, user, password from user;
+-----------+--------+-------------------------------------------+
| host      | user  | password                                  |
+-----------+--------+-------------------------------------------+
| localhost | root  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| 127.0.0.1 | root  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| localhost | trona  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| %        | trona  | *3E473C392738635BB3C40B77F339AE2B5B96AB5F |
| localhost | gnis  | *810EB1988696641613BC905C437D48DB0286A594 |
| %        | gnis  | *810EB1988696641613BC905C437D48DB0286A594 |
| localhost | bugs  | *20F70E9EB731F79D181E637A46E64D7E1050F956 |
| %        | bugs  | *20F70E9EB731F79D181E637A46E64D7E1050F956 |
| localhost | ged    | *4CA8F8F4B8B5DCC12808D5AE020BCCB3E522CCA6 |
| %        | ged    | *4CA8F8F4B8B5DCC12808D5AE020BCCB3E522CCA6 |
| localhost | ipplan | *EDA2B4CA7C3B7D3287C8DB2EA4850DFB25D9ED41 |
| %        | ipplan | *EDA2B4CA7C3B7D3287C8DB2EA4850DFB25D9ED41 |
+-----------+--------+-------------------------------------------+
12 rows in set (0.00 sec)

Hope this helps some.

sandwormusmc 06-24-2011 08:07 AM

Quote:

Originally Posted by digsecurity (Post 4394393)
hi all,
I am having problem with mysql server in fedora14. It throws the following error whenever I try to connect with root user.


It shows the same error when I just press mysql. I even cant change the root password. But I am able to login with other user.

If you have root on the box, shutdown mysql with a "service mysqld stop", then run mysql --skip-grant-tables. That will get you in and allow you to change the root password.

Good luck!

digsecurity 06-25-2011 11:29 PM

Quote:

Originally Posted by tronayne (Post 4394473)

Otherwise, either (1) there is no password set (so don't use -p on the command line) or (2) you don't have the correct password.

Yea, (2) was right. I was just typing the wrong password and thinking of some serious problem. I am really sorry for taking your time but this really helped me to remember that I had changed my root password.

Thank You


All times are GMT -5. The time now is 07:48 PM.