先ほど作ったMySQLの素晴ら…
【Linux全般】MySQLの設定をするよ
今回はVagrant上にあるCentOSにインストールしたMySQLを使いやすく設定する。
インストールした後、rootでログインする。
$ mysql -u root
現在登録されているユーザを確認する。
mysql> select host,user,password from mysql.user;

Vagrant上で動作しているCentOSなのでこんな表示になる。
localhostのrootユーザーのパスワードを設定する。
mysql> set password for root@localhost=password('パスワードを入力する'); Query OK, 0 rows affected (0.00 sec)
となった。
同じく、vagrant-centos64.vagrantup.comというホストの方もパスワードを設定する。
mysql> set password for root@'vagrant-centos64.vagrantup.com'=password('パスワードを入力する'); Query OK, 0 rows affected (0.00 sec)
できた。
匿名ユーザは要らないので消す
mysql>delete from mysql.user where user="";

消えました。
\q
でログアウト。
再度ログインしてみる。
mysql -u root
ちゃんとログイン出来ない。

パスワードありでログインする
mysql -u root -p
パスワードを聞かれるので入力します。(入力中、反応はありませんがちゃんと入力できています。) ちゃんとログインできました。

ディスカッション
コメント一覧
まだ、コメントがありません