You’ve backuped your database using mysqldump utility. Want to transfer your old database schema to your new database on a new server. But when you try to insert your schema you got an error like this :

#1044 - Access denied for user: 'your_user_name@localhost' to database 'your_database'

Why this error occured?

I’m using a simple problem find method in these situations. That’s this : Try to enter your data to the database line by line.

In our problem by doing my method i found a line that gave that error :

/*!40000 ALTER TABLE `mytable` DISABLE KEYS */;
LOCK TABLES `mytable` WRITE;

I think i’ve found the problem.

I searched mysql.com for lock tables command. I found a material of course. Here i’m making a quote :

As of MySQL 4.0.2, to use LOCK TABLES you must have the LOCK TABLES privilege and a SELECT privilege for the involved tables. In MySQL 3.23, you must have SELECT, INSERT, DELETE, and UPDATE privileges for the tables.

Here is the scenario :

Your old database which you’ve dumped may prior version of mySQL like 3.23.xx. And your new database is mostly new version of mySQL like 4.1.xx or later. But after mySQL version 4.0.2 you need some extra privileges on mysql table for your LOCK TABLES operations. But the administrator wasn’t give you this access.

So then, what you must do to solve this problem as easy as you can?

Just remove the LOCK TABLES; lines from your dump. It’ll solve this problem easily.

Tags: , ,
Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>