Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
![Reply](https://www.linuxquestions.org/questions/images/buttons/reply.gif) |
12-27-2006, 06:12 PM
|
#1
|
Member
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93
Rep:
|
mysql - can't access mysql database as root
Hi,
Does anyone know which file holds the mysql database? I've got the error
mysql> use mysql;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'
and all the different "fixes" I've tried have failed. I'd like to replace the current file with an original. I just need the filename.
Your help is much appreciated.
|
|
|
12-27-2006, 06:28 PM
|
#2
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: ![Reputation: 102](https://www.linuxquestions.org/questions/images/reputation/reputation_pos.gif)
|
Have you tried to give root All Privileges.
Code:
GRANT ALL PRIVILEGES on *.* to 'root'@'localhost
|
|
|
12-27-2006, 09:07 PM
|
#3
|
Member
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93
Original Poster
Rep:
|
thanks for the reply. I tried that and a lot of other things, none of them worked. In the end I removed the /var/lib/mysql/mysql/user.* files and ran /usr/bin/mysql_install_db and now I can get in.
No use if you've already got a bunch of users, but sorted out my problem.
|
|
|
12-28-2006, 05:34 AM
|
#4
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: ![Reputation: 102](https://www.linuxquestions.org/questions/images/reputation/reputation_pos.gif)
|
Quote:
Originally Posted by yogaboy
thanks for the reply. I tried that and a lot of other things, none of them worked. In the end I removed the /var/lib/mysql/mysql/user.* files and ran /usr/bin/mysql_install_db and now I can get in.
No use if you've already got a bunch of users, but sorted out my problem.
|
That will get you every time. The first time I have dealt with mysql I couldn't figure out why I was getting the same problem. But mysql_install_db sets up all the initial rights and gives the root account grant permissions on the user table under the mysql database.
One last thing. If you plan to administer you mysql db from a remote connection you might want to run
Code:
Grant ALL Privileges on *.* to 'root'@'%'
|
|
|
12-28-2006, 05:41 AM
|
#5
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Mysql installs a manual in /usr/share/doc/packages/mysql. There is a section on securing it. The default config has a couple tables where root has full privileges with no password.
|
|
|
12-28-2006, 07:58 AM
|
#6
|
Member
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93
Original Poster
Rep:
|
thanks for the help. Every time I've ever had to use mysql something has gone wrong at the setup stage, on whatever platform. You could say it was me ![Smilie](https://www.linuxquestions.org/questions/images/smilies/smile.gif) but I've been using the mysql manual or other people's instructions... personally, I think the setup is crap. It's insecure by default, and there's enough people out there posting with similar problems to make me think they ought to do something about it.
I'll be using Postgres next time - for all the extra work I at least want a real database - and if anyone says I have to use mysql then they can do it themselves!
|
|
|
All times are GMT -5. The time now is 06:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|