Can't reset root password with --skip-grant-tables on ubuntu 16

can synonym
can verb
meaning of can in hindi
can noun meaning
can band
can.'' acronym
can pronunciation
cant

I am trying to reset the root password following MysqlPasswordReset but when I try to start the server with --skip-grant-tables the server doesn't start

  • Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-59-generic x86_64)
  • mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64)

Server is running

$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Stop server

$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.

Trying to start with --skip-grant-tables

sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
[1] 9856

Connect with no password

$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[1]+  Exit 1                  sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

I also tried to start with mysql_safe (error.log is empty)

sudo mysqld_safe --skip-grant-tables
2017-02-01T16:33:31.382105Z mysqld_safe Logging to syslog.
2017-02-01T16:33:31.383942Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2017-02-01T16:33:31.386058Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2017-02-01T16:33:31.388009Z mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.

I found that the mysql.sock is deleted when the mysql service is stoped and mysqld_safe can't create it (I couldn't find the reason), so my solution was back up the sock folder and restore before start mysqld_safe

Start server

$ sudo service mysql start

Go to sock folder

$ cd /var/run

Back up the sock

$ sudo cp -rp ./mysqld ./mysqld.bak

Stop server

$ sudo service mysql stop

Restore the sock

$ sudo mv ./mysqld.bak ./mysqld

Start mysqld_safe

$ sudo mysqld_safe --skip-grant-tables --skip-networking &

Init mysql shell

mysql -u root

Change password

FLUSH PRIVILEGES;

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

Can, See also: Appendix:Variations of "can". Contents. 1 English. 1.1 Etymology 1. 1.1.​1 Alternative forms; 1.1.2 Pronunciation; 1.1.3 Verb. 1.1.3.1 Usage notes  Define can. can synonyms, can pronunciation, can translation, English dictionary definition of can. to be able to, have the power or skill to: I can take a bus to the airport. She can paint very well.

pedronalbert's answer above worked for me but the last step is now deprecated and throws the following warning:

Warning | 1287 | 'SET PASSWORD FOR = PASSWORD('')' is deprecated and will be removed in a future release. Please use SET PASSWORD FOR = '' instead

Use this command instead:

SET PASSWORD FOR root = '<plaintext_password>';

CAN, Can may refer to: Contents. 1 Containers; 2 Music; 3 Other; 4 See also. Containers[edit]. Aluminum can · Drink can · Oil can · Steel and tin cans · Trash can  Can definition, to be able to; have the ability, power, or skill to: She can solve the problem easily, I'm sure. See more.

I tried many ways including @pedronalbert 's but still not working.

The way I solved it is adding "skip-grant-tables" in /etc/my.cnf then start mysql service and connecting mysql with "mysql -u root" as https://www.codero.com/knowledge-base/content/33/296/en/how-to-reset-your-root-mysql-password.html

It works in my VM CentOS 7.

can, Nas' official music video for 'I Can'. Click to listen to Nas on Spotify: http://smarturl Duration: 4:27 Posted: 22 Mar 2011 can definition: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . (Definition of can from the Cambridge Business English

For Ubuntu 19 with MySQL 8.0.17-0ubuntu2, what ended up working for me was a combination of many answers:

  1. In the MySQL's configuration file (/etc/mysql/mysql.conf.d/mysqld.cnf on my machine), under [mysqld], add:

    skip-grant-tables = 1 plugin-load-add = auth_socket.so

  2. Restart the MySQL Service;

  3. Connect to MySQL: mysql -uroot;

  4. Run:

UPDATE mysql.user SET authentication_string=null WHERE User='root';
FLUSH PRIVILEGES;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pass123';
  1. Stop MySQL and comment skip-grant-tables in the configuration file;

  2. Start MySQL again and this should now work: mysql -u root -ppass123.

Can, We're going to show you how to track your status, if we can. We'll provide step-by-​step instructions on how to use the IRS' online status tracker,  110 synonyms of can from the Merriam-Webster Thesaurus, plus 97 related words, definitions, and antonyms. Find another word for can.

Nas - I Can (Official Video), contains food, but not if it contains a drink. empty beer cans. can - WordReference English dictionary, questions, discussion and forums. All Free.

How to track your coronavirus stimulus check status through the IRS , The definition of a can is a container normally made of metal with a lid. An example of can is what tuna comes in. verb. Can means someone or something knows  Inflections of 'can' (v): (⇒ conjugate) can v aux present could v aux past could v aux conditional cans v 3rd person singular (For the transitive verb) canning v pres p verb, present participle: -ing verb used descriptively or to form progressive verb--for example, "a singing bird," "It is singing."

Can dictionary definition, Can definition: You use can when you are mentioning a quality or fact about something which people may | Meaning, pronunciation, translations and  Can I Run It? System Requirements Lab analyzes your computer in just seconds, and it's FREE. See for yourself, takes less than a minute. The question of Can I run a PC game has been answered here hundreds of millions of times since 2005. Find out now if your computer can run any popular PC game.

Comments
  • Possible duplicate of ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
  • when using safe mode could you make connection using root? Did you try without the --skip-networking?
  • @davejal Yes, I tried without --skip-networking and I can't connect to the mysql server in safe mode
  • I had to set the password that way: stackoverflow.com/questions/37879448/…
  • On last command got ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded on Kubuntu 18.04
  • I believe this method is easier – superuser.com/a/1175035/320611
  • In mysql 5.7.24, the password column must be changed to authentication_string
  • after doing this mysql server didn't start
  • looks like they have removed an important functionality. with --skip-grant-tables the auth plugin is not loaded, and we cannot use set password, so there is no way to seems to revert the password. looks like we need to execute password('password') on a old mysql server, and copy paste the auth string, and update the table manually.
  • This method of configuring skip-grant-tables also works for Ubuntu 19 and MySQL 8.
  • This answer doesn't go into enough detail and will most likely not work. You can't just add skip-grant-tables randomly like it says. Check the answer below for the actual complete process to use.
  • Note that if you see that the UPDATE statement did not alter any rows (e.g. Query OK, 0 rows affected) it means you don't have a root user. In that case follow the instructions in this other answer to create it before running these queries again.