Asked By
johnhegry
1180 points
N/A
Posted on - 06/14/2011
Hi,
I have some concern here regarding MySQL database. I am in the process of creating a new database with a name 'ragnarok' when an error message came to my sight that I can't figure out what went wrong on the way.
Â
Execution Error
           Error while executing query.
               CREATE DATABASE ‘ragnarok’
               MySQL Error Number 1044
               Access denied for user ‘root’@’localhost’ to database ‘ragnarok’
It came to my mind, but I am not sure that resolving the hostname properly and that creating a file called 'hosts' will solve the problem, but it did not turn well, had a frustrating time figuring out this issue, but I am running out of ideas. I am now asking for someone to help me in figuring out a solution to my frustrating issue.
Thanks.
Problem Creating new Database in MySQL
Dear Jhonhegry,
I've gone through your problem. This problem arises for some reasons. Now I am giving one solution for this. As you have mentioned above, I think this is because that tour account does not contain necessary privileges to do so.
The following command can prove perfect for your problem:
(database_name).* to (user)@(hostname) identified by '(password)';
In this solution you do not need parentheses. Hope this will be the solution to your problem.
Thank you.
Answered By
obama
0 points
N/A
#122174
Problem Creating new Database in MySQL
It seems that the user root in the localhost does not have privileges on the database ‘ragnarok’. You may use the grant privileges command to give permissions to the user root to create databases in mysql server as follows;
grant all privileges to root@localhost on ragnarok.* identified by password;
Here the password means the password to use mysql databases in the server. If there is no password you can leave it. If you want to use the IP address of the host, you can use it instead of localhost in the command. After granting permissions to the root, you will be able to create the database.