LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 12-27-2006, 05:12 PM   #1
yogaboy
Member
 
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93

Rep: Reputation: 15
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.
 
Old 12-27-2006, 05:28 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Have you tried to give root All Privileges.
Code:
GRANT ALL PRIVILEGES on *.* to 'root'@'localhost
 
Old 12-27-2006, 08:07 PM   #3
yogaboy
Member
 
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93

Original Poster
Rep: Reputation: 15
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.
 
Old 12-28-2006, 04:34 AM   #4
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
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'@'%'
 
Old 12-28-2006, 04:41 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 12-28-2006, 06:58 AM   #6
yogaboy
Member
 
Registered: Oct 2004
Location: Londinium
Distribution: CentOs 4, OSX Tiger
Posts: 93

Original Poster
Rep: Reputation: 15
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 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!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql root privilages lost automaticaly on a database asheesh.tyagi Linux - Newbie 3 02-21-2006 09:55 AM
Need database program to access MySQL apachedude Linux - Software 12 01-03-2006 10:50 AM
Restoring MYSQL database without SSH shell access hct224 Linux - Newbie 5 01-08-2004 06:14 AM
MySQL on RedHat 9 GUI, can't access database linuxquestionsu Linux - Software 0 10-09-2003 02:44 PM
MySQL Cannot Access Database ChineseElite Linux - General 13 11-27-2002 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration