Goblin's Diary

バイクで鈴鹿サーキットを走ってます。色々書いています。

mysqlの設定(LANDISKで漕ぎいでな〜♪からパクった。)

LANDISKで漕ぎいでな〜♪がよく落ちているのでここに書いておく。

MySQLのrootパスワード設定
MySQLのrootパスワードを設定しておきましょう。
(注意:MySQLのrootパスワードであり、debianのrootパスワードではありません。)

landisk:~# mysqladmin -u root password 'MySQLのrootパスワード'

設定したパスワードでアクセスできるか確認しておきましょう。
landisk:~# mysql -u root -p
Enter Paaword: MySQLのrootパスワード
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40 to server version: 3.23.49-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit
Bye
landisk:~#

付録: MySQLデータベースの作成方法
ユーザ名 user 、パスワード passwd というアカウントで、データベース testdb を作成する例を示します。

landisk:~# mysql -u root -p
Enter password: ← MySQLのrootパスワード
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 173 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database testdb;
Query OK, 1 row affected (0.09 sec)

mysql> grant all on testdb.* to user@localhost identified by "passwd";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
landisk:~#

できたか確認してみます。
landisk:~# mysqlshow -uuser -ppasswd testdb
Database: testdb

                  • +
Tables
                  • +
                  • +

landisk:~#