Connecting Tech Pros Worldwide Help | Site Map
Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 29th, 2006, 11:23 PM
Banned
 
Join Date: Jul 2006
Location: Pakistan
Age: 23
Posts: 6
Default 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 +
+++++++++++++++++++++++++++++++++++
Reply
  #2  
Old July 30th, 2006, 02:32 PM
ronverdonk's Avatar
Moderator
 
Join Date: Jul 2006
Location: The Netherlands
Posts: 4,139
Default

Well, you obviously do not have the privilege of creating a data base.
Next quote from the MySql manual (www.mysql.com).
Quote:
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:
Reply
  #3  
Old August 26th, 2006, 01:01 PM
Needs Regular Fix
 
Join Date: Jul 2006
Posts: 269
Default

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.
Reply
  #4  
Old July 24th, 2007, 05:00 PM
Newbie
 
Join Date: Jul 2007
Posts: 2
Default

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.
Reply
  #5  
Old July 24th, 2007, 05:32 PM
Newbie
 
Join Date: Jul 2007
Posts: 2
Default

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.
Reply
  #6  
Old November 4th, 2007, 11:54 PM
Newbie
 
Join Date: Nov 2007
Posts: 1
Default

Quote:
Originally Posted by bclark
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?
Reply
  #7  
Old October 29th, 2008, 10:17 AM
Newbie
 
Join Date: Oct 2008
Posts: 1
Default

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...
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.