LoginSignup
2
2

More than 5 years have passed since last update.

MySQLのrootパスワードを変更したい

Posted at

とりあえず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> 

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2