I have an instance of MySQL server. I cannot log in. I did the following:

  1. Cleaned out some logs with > xxxx.log
  2. Restarted mysql with mysqld restart
  3. I did NOT use --user=mysql, but that is in my.cnf

Now I cant log in as ANY users.

How can I get this up and running the easiest and most correct way, without losing all the logins?


Reset the password of the super user. See C.5.4.1. How to Reset the Root Password from the MySQL manual for details on how this can be done. Basically, you create a SQL file that contains the commands for resetting the password and pass it to MySQL via the --init-file option.

As an alternative, start MySQL with the --skip-grant-tables option to enable anyone to connect without a password and with all privileges.

  • Did I lose all my logins? If not how do i get them back?
    – mike628
    Jul 29 '11 at 0:33
  • I do not know whether you lost all your logins. You certainly did not lose all your logins by following either of the methods I described. In case of the first method, what you lost and what you gained depends on the SQL file you used. In case of the second method, you did not lose anything; everything depends on the queries that you ran after you connected to the server. In any case, operation should be normal once you stop the MySQL server and start it normally.
    – Oswald
    Jul 29 '11 at 8:41
  • I still cant login. I tried both solutions.110729 05:11:08 mysqld started 110729 5:11:09 InnoDB: Started; log sequence number 5 2294003932 110729 5:11:09 [Note] /usr/libexec/mysqld: ready for connections. Version: '5.0.45-log' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
    – mike628
    Jul 29 '11 at 12:22

First thing you should check is the mysqld error log. Often found in /var/log/mysqld.log or /var/log/mysql/error.log.

I'm wondering if you clobbered your InnoDB transaction logs. E.g. /var/lib/mysql/ib_logfile*. This you should not do. They are fixed-length files that must match the expected size configured in my.cnf, or else mysqld will not start. The error log will tell you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.