MySQL: Access denied messages

MySQL

I have just installed Ubuntu on my server and MySQL.

I can't make any change in MySQL (seeting password, creating database, etc.) as I ALWAYS get an Access denied error message. I have followed the MySQL manuals re passwords, but to no avail.

The user name I use is the account name created when Ubuntu was installed.

At some point, I am told I need SUPER privileges to do this or that but I can't change the privileges since I get the same error message. I can't even see the GRANTS as I also get the same access denied message.
mysql version 14.14 Dist. 5.5.32, for debian-linux-gnu

Any idea on how to solve this?

To Arka:

Editing my own question is the only option I have to post this:

mysql> status

mysql Ver 14.14 Distrib 5.5.32, for debian-linux-gnu (i686) using readline 6.2
Connection id: 63
Current database:
Current user: charles@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.32-0ubuntu0.12.04.1 (Ubuntu)
Protocol version: 10
Connection: localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 6 hours 58 min 20 sec
Threads: 1 
Questions: 165 
Slow queries: 0 
Opens: 211 
Flush tables: 1 
Open tables: 51 
Queries per second avg: 0.006

Now, I have not been able to create a single database since the installation of the server this morning. I hope that helps. Thanks. 🙂

Best Answer

When you're installing MySQL you're asked to enter the root password that you want to set for the database. In the status code you've listed above you're logging in as charles@localhost and not root. That's the reason why it's not asking for the password you set during installation.

If you're logging in to MySQL using the root account then you can do all the things you want.

Simply type:

mysql -p -u root

and it'll ask you for the root password. Now you're "in" the system with full access. You can then create databases using:

CREATE DATABASE MyNewDatabase;

If you have a user that you want to give access to this new database you can type:

GRANT ALL ON MyNewDatabase.* TO 'charles'@'localhost';

When this is done you should be able to login as charles and also have full access to the newly created database.