I can not reset the password from muskulya:

$ sudo /etc/init.d/mysql stop [ok] $ sudo mysqld_safe --skip-grant-tables & [1] 6302 $ 150927 15:21:29 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. 150927 15:21:29 mysqld_safe Logging to '/var/log/mysql/error.log'. 150927 15:21:29 mysqld_safe A mysqld process already exists 
  • 3
    Possible duplicate question: How to find out the root user password for the MySQL database in Ubuntu? - aleksandr barakin
  • Well, almost, the fact is that I know two ways how to do it, and in both I had an error. That question is resolved, so I thought that no one would answer me there. - mr_blond97
  • @ mr_blond97, they thought correctly, since those solutions do not help, then the question is not its duplicate. - Visman
  • probably not all mysqld processes terminated after the ... stop command. Kill them: sudo pkill -KILL mysqld . - aleksandr barakin
  • there are shifts, unsubscribed below - mr_blond97

2 answers 2

When installing MySQL from packages in ubuntu, in addition to root, there is also the system user debian-sys-maint, if you did not delete this user, you can view his password in the /etc/mysql/debian.cnf file. The file is readable only from under the superuser. Using this user, you can reassign the password to the MySQL-root user using the command

 SET PASSWORD FOR 'root'@'localhost' = PASSWORD('пароль'); 

    I went under the root, did the same thing, it worked.

     # sudo /etc/init.d/mysql stop # ps axu # sudo mysqld_safe --skip-grant-tables & 

    Displays the message:

     150927 16:24:06 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect. 150927 16:24:06 mysqld_safe Logging to '/var/log/mysql/error.log'. 150927 16:24:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 

    I wait for 15 minutes, ^ C, I watch the processes:

     # ps axu 

    Suddenly there was no muscle in the process. I am glad, I continue:

     # mysql -u root mysql> use mysql; mysql> update user set password=PASSWORD("mynewpassword") where User='root'; mysql> flush privileges; mysql> \q # sudo /etc/init.d/mysql stop # sudo /etc/init.d/mysql start 

    On the one hand, the issue is resolved, on the other hand, it is not clear why it did not work under a non-user user.

    • using sudo you execute commands on behalf of another user (by default, this is the root user ). therefore, the point is not the user (in both cases it is the same as root ), but what I have already written to you in this comment . - aleksandr barakin
    • clear, unfinished processes. - mr_blond97