とりあえずmysqlを止める
service mysql stop
safeモードで起動する
/usr/bin/mysqld_safe --skip-grant-tables
password無しでログインできるようになる
mysql -u root
アップデートをかける
$ UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';
$ FLUSH PRIVILEGES;
mysql起動
$ mysql.server restart
確認
$ mysql -uroot -p
Enter password: 1234
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.49-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>