Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
This is off-topic for Stackoverflow; voting to migrate to Super User. –  David Thomas Jul 28 '11 at 22:27
add comment

migrated from stackoverflow.com Jul 28 '11 at 22:28

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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