patternsqlMinor
Access denied for user 'myuser'@10.% to database 'mydb' - Mysql Import SQL Script
Viewed 0 times
scriptmyusersqluserdenieddatabasemysqlformydbaccess
Problem
I have a database that I am trying to recreate at my web host. I used mysqldump to create a sql script. My web hosting company, IPage, has a hosted mysqladmin site where I am supposed to be able to import my script. When I run the script I get this error:
#1044 - Access denied for user 'myuser'@'10.%' to database 'mydatabase'
This user has full access to the database. Do I need to make some edits to my SQL script to get this working? Or is this a problem at my hosting site?
Thanks!
#1044 - Access denied for user 'myuser'@'10.%' to database 'mydatabase'
This user has full access to the database. Do I need to make some edits to my SQL script to get this working? Or is this a problem at my hosting site?
Thanks!
Solution
The message itself looks like an authentication issue.
Here is what you should do: If you can connect to the hosting company's mysql database from the mysql client, run this command:
What will these functions give you ?
It's the second function you need to be concerned with because it says you have the same user permissons as
@Abdul's answer reveals a deeper issue: You created the mysqldump which has the command to create the database. When you mysqldump with the --databases option, the
This will place the database and table creation statements in
If you cannot run
You could then load the data using
I also noticed the user mysql was expecting 'myuser'@'10.%' as the user to authenticate. You might need 'myuser'@'IP-of-DBServer' defined on the database mydb with this:
Give it a Try !!!
Here is what you should do: If you can connect to the hosting company's mysql database from the mysql client, run this command:
SELECT USER() RequestedUserLogin,CURRENT_USER() AllowedUserLogin;What will these functions give you ?
- USER() reports how you attempted to authenticate in MySQL
- CURRENT_USER() reports how you were allowed to authenticate in MySQL
It's the second function you need to be concerned with because it says you have the same user permissons as
AllowedUserLogin.@Abdul's answer reveals a deeper issue: You created the mysqldump which has the command to create the database. When you mysqldump with the --databases option, the
create database mydb; is inserted before the use mydb;. You can hide the create database mydb; by doingmysqldump -u... -p... --no-data --databases mydb > mydbschema.sql
mysqldump -u... -p... --no-create-info mydb > mydbdata.sqlThis will place the database and table creation statements in
mydbschema.sql while the bulk INSERTs are placed in mydbdata.sql.If you cannot run
mydbschema.sql then have the hosting company create the database for you. You could also use whatever DB tools they have setup for you to create the database yourself.You could then load the data using
mysql -umyuser -pmypassword -h(IP-of-DBServer) -Dmydb < mydbdata.sqlI also noticed the user mysql was expecting 'myuser'@'10.%' as the user to authenticate. You might need 'myuser'@'IP-of-DBServer' defined on the database mydb with this:
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'IP-of-DBServer';Give it a Try !!!
Code Snippets
SELECT USER() RequestedUserLogin,CURRENT_USER() AllowedUserLogin;mysqldump -u... -p... --no-data --databases mydb > mydbschema.sql
mysqldump -u... -p... --no-create-info mydb > mydbdata.sqlmysql -umyuser -pmypassword -h(IP-of-DBServer) -Dmydb < mydbdata.sqlGRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'IP-of-DBServer';Context
StackExchange Database Administrators Q#13828, answer score: 2
Revisions (0)
No revisions yet.