General Discussion

Mysql root issues, cannot log into the database as a root

If you face such an error —–>

ERROR 1045: Access denied for user: ‘root@localhost’ (using password: NO).

Solution :

You have set a password on the root account. This is a good thing. Start MySQL by:

MySQL -p

and it will prompt for the password.

If you don’t know the password, you can re-run the /scripts/mysql_install_db script to rebuild the MySQL database. You might need to delete the /data/mysql directory to do this, but I’m not positive.

Since you’ve just installed the server this shouldn’t disrupt any existing user/database relationships.

And if there’s no default password- just running “mysql” when logged into the server as root should get you in.

The method to change the password is (as root):
“update mysql.user set password=password(’newpass’) where user=’root’;”

Then try

” mysqladmin -u root -p password ” or ” mysqladmin -u user -password ”

If you’re logged into the server as “root”, then the “-u root” is optional. Mysql will use the currently-logged-in userid unless told otherwise.

If you have any queries regarding this KB, you can contact bodHOST technical support staff.