ブログ - Raspberry PiにMySQLをインストールしてみた その2
raspberry Piに前回,MySQLをインストールしたので,管理ユーザのrootにパスワード設定を行ってみる.
まずは,パスワードなしでrootユーザで接続できることを確認.
パスワードなしでログインできた.パスワードを設定する.
まずはMySQLから一旦接続を切る.
管理用のコマンドラインツールを確認.
mysqladminツールでパスワードを設定.
ここではnew-passwordというパスワードを設定している.もう一度先ほどと同じようにrootユーザで接続して見る.
パスワードを設定したからか,アクセス拒否される. -pオプションを使ってパスワードを指定する
設定したパスワードを入力する.
繋がりました.
まずは,パスワードなしでrootユーザで接続できることを確認.
pi@commet:~ $ mysql -uroot🆑
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.5.57-0+deb8u1 (Raspbian)
Copyright (c) 2000, 2017, 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>
まずはMySQLから一旦接続を切る.
mysql> quit🆑
Bye
pi@commet:~ $
pi@commet:~ $ which mysqladmin🆑
/usr/bin/mysqladmin
pi@commet:~ $
pi@commet:~ $ /usr/bin/mysqladmin -u root password 'new-password'🆑
pi@commet:~ $
pi@commet:~ $ mysql -uroot🆑
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
pi@commet:~ $
pi@commet:~ $ mysql -uroot -p🆑
Enter password:🆑
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.5.57-0+deb8u1 (Raspbian)
Copyright (c) 2000, 2017, 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>