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-02-2009, 10:00 PM   #1
Chili.Willy
LQ Newbie
 
Registered: Jul 2007
Location: Stevens Point, Wisconsin, USA
Distribution: Debian Bookworm, Raspbian. Also Mint, SliTaz, Sparky, Xubuntu.
Posts: 28

Rep: Reputation: 1
MySQL: Can't GRANT privileges after restoring a database


I had a MySQL database called MyReferences to keep track of articles and books that I've read. I don't know how, but it disappeared. I never made a native MySQL backup (with mysqldump or such), but I did make backups of all the files in the computer.

This is a Debian system, and the files that contain MySQL databases are in /var/lib/mysql/. On my backup system there is a copy of /var/lib/mysql/MyReferences/. I copied that directory into /var/lib/mysql/ on my active system.

I had to change file ownerships and permissions to make the database “visible” in MySQL. They look like this:
-rw-r--r-- 1 mysql mysql 0 2009-09-02 20:20 debian-5.0.flag
-rw-rw---- 1 mysql mysql 10M 2009-11-27 17:48 ibdata1
-rw-rw---- 1 mysql mysql 5.0M 2009-11-27 17:49 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M 2009-06-03 22:28 ib_logfile1

drwx------ 2 mysql mysql 4.0K 2009-11-28 22:58 MyReferences
drwxr-xr-x 2 mysql mysql 4.0K 2009-09-02 20:20 mysql
-rw------- 1 mysql mysql 7 2009-06-03 22:28 mysql_upgrade_info

drwx------ 2 mysql mysql 4.0K 2009-06-11 22:42 NYM2009


NYM2009/ corresponds to an empty database, and its contents look like
-rw-rw---- 1 mysql mysql 65 2009-06-11 22:42 db.opt
This empty database was created on this system and never had to be restored from backup, so I assume the owner and permissions are correct.

The contents of MyReferences/ are
-rw-rw---- 1 mysql mysql 65 2009-11-28 22:58 db.opt
-rw-rw---- 1 mysql mysql 9.1K 2009-11-28 22:58 MyRefs.frm
-rw-rw---- 1 mysql mysql 1.5M 2009-11-28 22:58 MyRefs.MYD
-rw-rw---- 1 mysql mysql 28K 2009-11-28 22:58 MyRefs.MYI


The owner, group, and permissions are the same as for that NYM2009 database.

I ran MySQL as root and issued
Code:
GRANT ALL ON MyReferences.* TO 'Will'@'localhost';
and it seemed to work normally.

But, when I ran MySQL as Will and tried to
Code:
LOAD DATA INFILE "/home/Will/RefInput" INTO TABLE MyRefs FIELDS TERMINATED BY '#';
I got this error:
Code:
ERROR 1045 (28000): Access denied for user 'Will'@'localhost' (using password: YES)
When I run MySQL as root, the LOAD DATA command works fine.

After reading some LinuxQuestions.org posts, I tried adding
Code:
IDENTIFIED BY 'mypassword'
to the GRANT command, but it didn’t make any difference. I also tried changing my MySQL password and re-issuing the GRANT command.

I can run SELECT statements and view the stucture of the MyReferences database, so I have partial access. Why not LOAD DATA INFILE? Somehow, my GRANT command doesn't seem to be working, even though MySQL acknowledges it normally.

Thanks for any ideas,
Will
 
Old 12-02-2009, 11:27 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You need to log in to mysql as "root", and grant user "will@localhost" the FILE privilege:


http://dev.mysql.com/doc/refman/5.1/...-provided.html

http://dev.mysql.com/doc/refman/5.1/...structure.html

Last edited by paulsm4; 12-02-2009 at 11:30 PM.
 
Old 12-03-2009, 09:21 PM   #3
Chili.Willy
LQ Newbie
 
Registered: Jul 2007
Location: Stevens Point, Wisconsin, USA
Distribution: Debian Bookworm, Raspbian. Also Mint, SliTaz, Sparky, Xubuntu.
Posts: 28

Original Poster
Rep: Reputation: 1
Thanks much, paulsm4. That solves it.
 
  


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
Grant Privileges - MySQL Jannyno Linux - General 2 06-23-2012 02:00 AM
Restoring mysql database h725 Linux - Server 1 03-25-2009 04:24 AM
Restoring a running mysql database mazzo Linux - Server 4 04-27-2007 11:25 AM
restoring mysql database MrSako Linux - Software 2 12-09-2006 02:42 PM
MySQL: Grant user database creation rights Swakoo Linux - General 4 09-13-2006 06:34 AM

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

All times are GMT -5. The time now is 01:44 PM.

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