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 databasetestdb;
Query OK, 1 row affected (0.09 sec)
mysql> grant all ontestdb.* 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-ppasswdtestdb
Database: testdb
+--------+
| Tables |
+--------+
+--------+
landisk:~#