Jump to content

Recommended Posts

Posted

Hi there,

 

I'm trying to import a database and kept getting ERROR 1044 Access denied for user 'username'@'%' to database 'databasename'

 

So, I've tried to grant permissions to the user by using the command below:

 

GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

 

I get the following error:

 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySql server Version for the right syntax to use near 'IDENTIFIED BY 'password' WITH GRANT OPTION' at line 1

 

I don't have a manual, the MySQL server version is 5.0.90 and phpMyAdmin is 2.11.9.6

 

Can anyone help point me in the right direction please?

Posted (edited)

@bossman:

 

I'm trying to help OH here - neither of us know what we're doing!

 

I'm accessing phpMyAdmin via a control panel called "plesk". In this I created a database and then a user with password, but there seems to be no means to set what privileges this user has. Anyway got as far as trying the following:

 

GRANT ALL PRIVILEGES ON databasename.* TO username@'localhost' IDENTIFIED BY 'password';

 

and got the original error, ERROR 1044 Access denied for user 'username'@'%' to database 'databasename'

 

So now I'm thinking I need to tell MySql that this user does have access. The info I can find (phpMyAdmin 3.5.0-dev - Documentation) tells me to the following:

 

phpMyAdmin does not apply any special security methods to the MySQL database server. It is still the system administrator's job to grant permissions on the MySQL databases properly. phpMyAdmin's "Privileges" page can be used for this.

 

Thing is I can't find the "Privileges" page :(

 

Hope you can help.

Edited by tazz
Posted

From memory in Plesk you use Plesk itself to grant the privileges as you possibly don't have access to the MySQL root account to do the GRANT statement stuff.

 

(you may well do if it's a dedicated system, but if it's shared I'd be surprised).

Posted

You shouldn't need to set permissions on the database user when you set up the database.

can you open your .sql file in say word and have a look to see if it trying to create a database usually be the lines

 

CREATE DATABASE `newdatabase`; 
USE user;

 

comment these out, then give it another shot

Posted

As it's Plesk, and likely a shared hosting environment, your actual database/user names might need to be prefixed with the main Plesk account name, or similar, "behind the scenes".

 

Anyway, if you remove the blank database and user that you've created; you should be able to do this:

 

In phpMyAdmin, go to create a new user. In there, should be a box called 'Database for user'. Click the option that says 'Create database with same name and grant all privileges'. When done, you should have a database and user that are named the same with proper permissions granted.

Posted (edited)

@webman:

 

I deleted the user and database, but can't see how to create a user or database in myPhpAdmin- I'm not sure if this is a cut down version provided by the hosting provider.

 

I created a db and user both with the name of the main plesk account. Get No Privileges under Create new database. Please see pics.

 

phpMYAdmin02.JPG

 

When I try to import the sql file I get access denied

 

phpMYAdmin01.JPG

 

Further background information that may help:

 

We are using Parallels Plesk 9.5 which runs phpMyAdmin 2.11.9.6 and MySql Client Version 5.0.90, provided by the hosting provider.

 

Trying to follow the instructions for phpMyAdmin which suggests running /domains/databases/scripts/setup.php to configure config.inc.php

 

This brings up a GUI to configure the server, but there is a warning message of

 

phpMYAdmin03.JPG

 

I've tried creating a folder called config in the top level of the website, but get the error below - also, I'm not certain that's where it means.

 

Error: Unable to create directory /config: filemng failed: mkdir: cannot create directory `/var/www/vhosts/websitename.co.uk/config': Permission denied

filemng: Error occured during /bin/mkdir command.

 

I'd like to be able to actually manually edit config.inc.php, but can't locate it.

 

Hope you can help.

Edited by tazz
Posted

If you're using the phpMyAdmin that is provided by Plesk, then you shouldn't need to do any extra configuration or editing of files. Also, you don't seem to have the option for creating users in there. Plesk probably has a recommended way of creating users and databases from its own control panel, rather than through phpMyAdmin.

 

From the screenshots, in phpMyAdmin, you don't have permission to create any databases or users - which is why the query is failing.

Posted

Okay I have plesk so I'll outline my steps...

 

 

Login to Plesk > Click Domains > Click Domain Concerned > Click Databases > Click Add New Database > Fill out the information and save it

 

Database Created

 

Click on the Database you just created > Click Add New User > Fill out the Details and save it

 

Username Created

 

Click on Webadmin and from there your back into phpmyadmin (make sure your script doesn't try to create any databases or use a specific username and you should be fine)

Posted

@mossj:

 

Maybe that's the problem. The sql database I'm trying to import is an export from another plesk managed site? The username and password I'm using is set to the same as the originating site.

Posted
@mossj:

 

Maybe that's the problem. The sql database I'm trying to import is an export from another plesk managed site? The username and password I'm using is set to the same as the originating site.

 

I think the main problem is the script your trying to import

 

 

When you go into phpadmin from plesk you are already logged in as a user and already inside a database

 

So you want your script to not bother with and database creation or user logging in/creation

 

I'd suggest making a back up of the import file then try removing references to databases and users

  • 2 months later...
Posted

You appear to be trying to import a database, where you should be trying to import its tables. MySQLAdmin shows you do not have 'create database' permission (typical on free hosting sites), so the database you currently have, is what you will have to use.

 

Import the TABLES, not the database. (Correct me if I am wrong, I usually am!)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...