MySQL - Cannot access as root

Andrew L. Gould algould at datawok.com
Thu Jul 28 21:43:53 GMT 2005


On Thursday 28 July 2005 04:20 pm, Gerard Seibert wrote:
> I have just installed MySQL 5. I can access the program as a regular
> user, but not as root. As I regular user I have no privileges. If I
> attempt to access as root, I receive this error message.
>
> ERROR 1045 (28000) Access denied for user 'root'@'localhost' (using
> password: NO)
>
> I can access the program as root using: mysql -u root -p and then
> supplying a password at the prompt, but that is about it.
>
> What can I do to correct this problem? I tried deleting the entire
> package and reinstalling it, but the problem continues. When I first
> installed the program, it worked, but only one time. Obviously, I did
> something, but I do not know what.

The system root user is separate from MySQL's root user.  The system 
root user should not be able to access the database server directly.  I 
think this is true for both MySQL and PostgreSQL.

If you can log in using 'mysql -u root -p [password]', then everything 
is okay to start.  It's not that you did something wrong, rather you 
haven't finished setting up the database for your user.

Database servers aren't like gui text editors.  It's important that you 
read the documentation.  Here are some helpful links:

Start here for your immediate needs:
http://dev.mysql.com/doc/mysql/en/default-privileges.html

Manual Index:
http://dev.mysql.com/doc/mysql/en/index.html

MySQL Tutorial:
http://dev.mysql.com/doc/mysql/en/tutorial.html

Best of luck,

Andrew Gould


More information about the freebsd-questions mailing list