Unable to login to MySQL from the server console

  • 3325333
  • 25-Sep-2006
  • 26-Apr-2012

Environment


Novell NetWare 6.5

Situation

After a default install of MySQL from the products disk, root authentication fails when issuing the mysql -u root -p command.

Error: ERROR 1130: HOST 'loopback' is not allowed to connect to this MySQL server


Resolution

When the MySQL server is in this state, several off the standard commands will fail. ie: grant, create database, etc. Since this error also prohibits any changes to the user table, several steps must be taken to correct the issue:

At the server console, key the following commands.

1. unload mysqld
2. load mysqld_safe --skip-grant-tables
3. mysql -u root -p
4. The MySQL client will now launch; key the following commands:
a. flush privileges;
b. exit;
5. unload mysqld
6. load mysqld_safe --autoclose
7. mysql -u root -p
8. Key your password and hit

You will now have access to the MySQL server. From here you will be able to continue with the configuration of the MySQL environment.

Additional Information

If the root password has been forgotten, perform the following steps to reset it.

Note: You must have the MySQL daemon running with the --skip-grant-tables option first.

mysql> USE mysql ;

mysql> UPDATE user
-> SET password=password("newpassword")
-> WHERE user="root";

mysql> flush privileges;