3

What I had already performed are:

sudo /etc/init.d/mysql stop
/usr/sbin/mysqld --skip-grant-tables --skip-networking & 

After this I am getting:

[Warning] Using unique option prefix key_buffer instead of
key_buffer_size is deprecated and will be removed in a future release.  
Please use the full name instead.

150929 11:48:31[Note] /usr/sbin/mysqld (mysqld ....)starting as
process 3633 ...

And its not processed further.

What to do?

snoop
  • 4,110
  • 9
  • 41
  • 58

3 Answers3

3

Next steps could be:

  1. In terminal:

    mysql
    
  2. In mysql shell:

    use mysql;
    select user,password,host from user;
    update user set password=password("newpassword") where user=root;
    select user,password,host from user;
    flush tables;
    FLUSH PRIVILEGES;
    quit
    
  3. In terminal:

    kill -15 `pgrep -f 'skip-grant-tables' 
    service mysql start
    mysql -u root -p
    
snoop
  • 4,110
  • 9
  • 41
  • 58
Ova
  • 466
2

What you did is correct, as explained in the manual (see MySQL 5.5 manual under point B.5.4.1.3). At the point you stopped, your MySQL server is started without permissions control. All you have to do is to follow the next steps in the above link (summarized hereunder):

  1. Connect to your MySQL server via the terminal:

    shell> mysql
    
  2. Reload the grant tables so that account-management statements work:

    mysql> FLUSH PRIVILEGES;
    
  3. Change the password (don't forget the ; at the end):

    mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
    
  4. Exit MySQL client and restart mysql server normally:

    mysql> exit;
    shell> sudo service mysql restart
    

By the way, it is better to use the service start/stop/restart/status to manage the various services like mysqld than to use the /etc/init.d/ version like you did.

snoop
  • 4,110
  • 9
  • 41
  • 58
1
  1. Log on to your system as the Unix user that the MySQL server runs as (for example, mysql).

  2. Stop the MySQL server if it is running. You did that with:

    su /etc/init.d/mysql stop
    
  3. Create a text file containing the following statement on a single line. Replace the password with the password that you want to use.

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
    

Save the file. This example names the file /home/me/mysql-init. The file contains the password, so do not save it where it can be read by other users. If you are not logged in as mysql (the user the server runs as), make sure that the file has permissions that permit mysql to read it.

  1. Start the MySQL server with the special --init-file option:

    shell> /usr/sbin/mysqld --init-file=/home/me/mysql-init &
    

The server executes the contents of the file named by the --init-file option at startup, changing the 'root'@'localhost' account password.

  1. After the server has started successfully, delete /home/me/mysql-init.

  2. Kill mysqld and start it with:

    su /etc/init.d/mysql start
    
snoop
  • 4,110
  • 9
  • 41
  • 58
nobody
  • 4,412