MySQL をインストールする
インストール前に確認をする
% apt-cache search mysql | grep ^mysql mysql-admin - GUI tool for intuitive MySQL administration mysql-admin-common - Architecture independent files for MySQL Administrator mysql-client - mysql database client (meta package depending on the latest version) mysql-client-5.0 - mysql database client binaries mysql-common - mysql database common files (e.g. /etc/mysql/my.cnf) mysql-navigator - GUI client program for MySQL database server mysql-query-browser - Official GUI tool to query MySQL database mysql-query-browser-common - Architecture independent files for MySQL Query Browser mysql-server - mysql database server (meta package depending on the latest version) mysql-server-4.1 - mysql database server (transitional package) mysql-server-5.0 - mysql database server binaries mysqltcl - Interface to the MySQL database for the Tcl language
ライブラリ群を確認する。
% apt-cache search mysql | grep ^libmysql libmysql++-dev - mysql C++ library bindings (development) libmysql++2c2a - mysql C++ library bindings (runtime) libmysql-java - Java database (JDBC) driver for MySQL libmysql-ocaml - OCaml bindings for MySql libmysql-ocaml-dev - OCaml bindings for MySql libmysql-ruby - MySQL module for Ruby libmysql-ruby1.8 - MySQL module for Ruby 1.8 libmysqlclient15-dev - mysql database development files libmysqlclient15off - mysql database client library
MySQL のインストール
% sudo apt-get install mysql-server-5.0 mysql-common mysql-client-5.0 % sudo dpkg -l | grep mysql ii libdbd-mysql-perl 3.0008-1 A Perl5 database interface to the MySQL data ii libmysqlclient15off 5.0.32-7etch8 mysql database client library ii mysql-client-5.0 5.0.32-7etch8 mysql database client binaries ii mysql-common 5.0.32-7etch8 mysql database common files (e.g. /etc/mysql ii mysql-server-5.0 5.0.32-7etch8 mysql database server binaries ii php5-mysql 5.2.0-8+etch13 MySQL module for php5
MySQL インストール時に存在するパスワードがないユーザーの設定を変更する
パスワードが設定されないユーザーを表示する。
% mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.0.32-Debian_7etch8-log Debian etch distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select user, host, password from mysql.user; +------------------+-----------+-------------------------------------------+ | user | host | password | +------------------+-----------+-------------------------------------------+ | root | localhost | | | root | yourhost | | | debian-sys-maint | localhost | *A9D94C7AF5CF36D28786933C00D689C06B178798 | +------------------+-----------+-------------------------------------------+ 3 rows in set (0.00 sec)
パスワードを設定する。
mysql> set password for 'root'@'localhost'=password('yourpassword'); Query OK, 0 rows affected (0.01 sec) mysql> set password for 'root'@'yourhost'=password('yourpassword'); Query OK, 0 rows affected (0.00 sec)
設定後の内容を確認する。
mysql> select user, host, password from mysql.user; +------------------+-----------+-------------------------------------------+ | user | host | password | +------------------+-----------+-------------------------------------------+ | root | localhost | *0480E553996615G11F49D24A263ACACD723FB599 | | root | yourhost | *0480E553996615G11F49D24A263ACACD723FB599 | | debian-sys-maint | localhost | *A9D94C7AF5CF36D28786933C00D689C06B178798 | +------------------+-----------+-------------------------------------------+ 3 rows in set (0.00 sec)