hey friends...
i am using fedora 13...

when i am trying to access a database i am getting this error--

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


i also tried accessing by switching to superuser.. but i get this error --

[user@localhost ~]$ su
[root@localhost user]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


also when i am using mysql in user mode... i am able to access the test database which i had created earlier...

Database changed
mysql> show tables;
| Tables_in_test |
| Product |
| Products |
| ajax_example |
| employees |
| name |
| names |
| student |
| users |
8 rows in set (0.00 sec)

can somebody please tell me what the problem is??

Keep in mind that the users in MySQL are different and totally separate from the operating system users, even if they are named the same. So, when you are logged into the mysql command line system with the first account user ''@'localhost' you are starting the command line system without declaring a user. Try this:

shell> mysql -u root -p

Since you most likely have not set a password for the MySQL root user, simply press the enter key.

When you are failing to start the mysql command line system as the operating system root user, you still need to pass MySQL a username (as seen above).

The reason you can access the test datbase is that any databases or tables or anything that you are allowed to create as a particular user will be available to that user. And EVERYONE has access to the test database. That's why it's a good idea to drop that database as soon as you can.

There are lots of good resources out there on the Internet regarding getting started with MySQL. Here's one that I use every day:


Remember to start at the beginning, go slow and have patience. MySQL is not something you can learn in a day and be effective at using it. No real DBMS is.

I hope this helps -

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.