472,096 Members | 2,007 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

ERROR 1044: Access denied : How i ruin this error?

I got an error... when i wants to create database "usersinfo"
Username is 'blacksmoke'...

Commandline argumments are:

mysql> select user();
[Is shows correct] : e.g., blacksmoke@localhost

-------

mysql> create database usersinfo;
ERROR 1044: Access denied for user: '@localhost' to database 'usersinfo'

-------

mysql> show databases;
++++++++++++++++++++
+ Databases +
++++++++++++++++++++
+ test +
++++++++++++++++++++
[its ok]..

-------

mysql> use test;
Database changed
[its also ok]..

-------------------------------

but where is error... really i am serious confused... please help Me...
Ooooh! i am tired... help me...

+++++++++++++++++++++++++++++++++++
+ Voice for Help of +
+++++++++++++++++++++++++++++++++++
+ Muhammad Juanid Ahmed Atari +
+++++++++++++++++++++++++++++++++++
Jul 29 '06 #1
9 105958
ronverdonk
4,258 Expert 4TB
Well, you obviously do not have the privilege of creating a data base.
Next quote from the MySql manual (www.mysql.com).
Note: If you get an error such as ERROR 1044 (42000): Access denied for user 'monty'@'localhost' to database 'xxxx' when attempting to create a database, this means that your user account does not have the necessary privileges to do so. Discuss this with the administrator or see Section 5.7, “The MySQL Access Privilege System”.
Ronald :cool:
Jul 30 '06 #2
vssp
268 100+
grant all on (database_name).* to (user)@(hostname) identified by '(password)';

this is the command you need. The parenetheses are not needed, I use them to indicate where you have to put in your specific values. If you are just running one machine you can use localhost for you hostname.

If you need further info on the GRANT command. RTFM.
Aug 26 '06 #3
bclark
2
I am at the same place the guy above was.

I installed mysql into my home directory ( /home/bclark/opt ).

Logged in as the unix user bclark, I issued the command:

mysql_install_db --user=bclark

Then

mysqld_safe --port=10100 --user=bclark &

Then

mysql --user=bclark -p

I never set a password for the superuser bclark, so I just press enter when it prompts me for a password. This is a workstation with only one user ( me ) and I run a firewall, so nobody will be connecting to port 10100. This database is for my personal use, and nothing critical will be stored on it anyway.

Then I do:

mysql> select user();
+------------------+
| user() |
+------------------+
| bclark@localhost |
+------------------+

This is good. ( new to mysql as I am, I expect to have superuser database privileges. However, I do:

mysql> create database mydb
-> ;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mydb'

So I read this thread and do:

mysql> select current_user();

+----------------+
| current_user() |
+----------------+
| @localhost |
+----------------+
1 row in set (0.00 sec)


Hmm, this thread recommends that I need to grant permissions to a user.

I decide to look at the mysql.user table as suggested.

mysql> select * from mysql.user
-> ;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'


Hmm, can't do that.

I would issue the grant command, but I don't know how to log into mysql as the superuser.

How do you do that?

I don't mind wiping out my mysql installation and starting over, but I would rather not create a mysql user or do anything as root ( though I have root access to the box ) I want this to be a local installation of mysql in my home directory for my personal use that does not interfere with the rest of my system.
Jul 24 '07 #4
bclark
2
Ok, I figured it out.

It was step 9 of the mysql version 4.1.22 installation instructions that confused me.

It reads:


9. If you have not installed MySQL before, you must create the MySQL
grant tables:

shell> bin/mysql_install_db --user=mysql

If you run the command as `root', you should use the `--user'
option as shown. The value of the option should be the name of the
login account that you created in the first step to use for
running the server. If you run the command while logged in as that
user, you can omit the `--user' option.


I thought this meant that the mysql superuser would be created to be bclark. I didn't understand that the mysql superuser is root regardless of what you do here.

So I do:

mysql -u root

And I see:

----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

I do:
mysql> select user, password, host from mysql.user;

+------+----------+------------+
| user | password | host |
+------+----------+------------+
| root | | localhost |
| root | | redacted |
| | | redacted |
| | | localhost |
+------+----------+------------+

Now my CREATE DATABASE command works fine.

I hope answering my own question here will save other mysql newbies who may have been confused in the same way I was some time.
Jul 24 '07 #5
Ok, I figured it out.

It was step 9 of the mysql version 4.1.22 installation instructions that confused me.

It reads:


9. If you have not installed MySQL before, you must create the MySQL
grant tables:

shell> bin/mysql_install_db --user=mysql

If you run the command as `root', you should use the `--user'
option as shown. The value of the option should be the name of the
login account that you created in the first step to use for
running the server. If you run the command while logged in as that
user, you can omit the `--user' option.


I thought this meant that the mysql superuser would be created to be bclark. I didn't understand that the mysql superuser is root regardless of what you do here.

So I do:

mysql -u root

And I see:

----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

I do:
mysql> select user, password, host from mysql.user;

+------+----------+------------+
| user | password | host |
+------+----------+------------+
| root | | localhost |
| root | | redacted |
| | | redacted |
| | | localhost |
+------+----------+------------+

Now my CREATE DATABASE command works fine.

I hope answering my own question here will save other mysql newbies who may have been confused in the same way I was some time.
I can't understand that. What did you write there?
mysql> select user, password, host from mysql.user; ???? command select user or for example- select tupkreten and is it coma after that?
Nov 4 '07 #6
just type the following command & enter a root password 4 mysql server...most prob(ly) this will solve ur problem...it worked 4 me

cmd :

mysql --user=root -p

=======================my sys log ==========================

mysql> create database arunmanoj;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'arunmanoj'

mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| @localhost |
+----------------+
1 row in set (0.07 sec)

arunmanoj@arunmanoj-desktop:~$ mysql --user=root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 30
Server version: 5.0.67-0ubuntu6 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database test;
Query OK, 1 row affected (0.06 sec)


mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.06 sec)

================================================== ========

if u want more info regarding this feel free 2 contact me...
Oct 29 '08 #7
Mala7
2
Thanks arunmanoj .. i was having the same problem but now it is done
Sep 6 '10 #8
jscpp
1
I meet the problem on OpenSUSE 11.4

Look for my story

root# mysql_install_db

auser> mysql -u root
mysql> create database work
mysql> create user workDba
mysql> grant all on work.* to workDba;
mysql> select host, user from user where user='workDba';
-------------------
mysql shows the data in table:
user=workDba
host=%
------------------
mysql> \q
user> mysql -u workDba work
ERROR 1044 (xx) Access denied (to|on) ''@'localhost'
user> mysql -u root
mysql> create user workDba@localhost;
mysql> show grants for workDba;
----------------
you cal see yourself
----------------
mysql> \q
user> mysql -u workDba work
mysql> \q #this is finish of the last sesion
Idea: kill user workDba!
user> mysql -u root
mysql> drop user workDba;
mysql> \q
user> mysql -u workDba work
---------------
Ok. error
---------------
user> mysql -u root
mysql> create user workDba;
mysql> grant all on work.* to workDba;
mysql> \q
user> mysql -u workDba work
mysql> ...
so may be it shall not help in any case but in my case it works fine
I take idea on "http://dev.mysql.com/doc/refman/5.1/en/access-denied.html": "If you cannot figure out why you get Access denied, remove from the user table all entries that have Host values containing wildcards (entries that contain '%' or '_' characters). A very common error is to insert a new entry with Host='%' and User='some_user', thinking that this enables you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host='localhost' and User=''. Because that entry has a Host value 'localhost' that is more specific than '%', it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host='localhost' and User='some_user', or to delete the entry with Host='localhost' and User=''. After deleting the entry, remember to issue a FLUSH PRIVILEGES statement to reload the grant tables. See also Section 5.4.4, “Access Control, Stage 1: Connection Verification”."
Sep 10 '11 #9
thanks a lot arunmanoj bro......
Jul 11 '14 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by John | last post: by
reply views Thread by Morten Gulbrandsen | last post: by
3 posts views Thread by dstewart | last post: by
1 post views Thread by Shun | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.