–
ServersMan@VPSにMySQLのインストールと設定を行います。
設定には「SSH」での接続・コマンド操作が必要となりますので、SSHでの接続方法が分らない場合は、 URLを参考にしてサーバに接続をお願い致します。 参考:sshでVPSサーバにログイン
MySQLサーバのインストール
1. 「yum」コマンドを用いてmysal-serverをインストールします。
# yum -y install mysql-server Loaded plugins: fastestmirror Repository 'vz-base' is missing name in configuration, using id Repository 'vz-updates' is missing name in configuration, using id Determining fastest mirrors * addons: ftp.jaist.ac.jp * base: ftp.jaist.ac.jp * extras: ftp.jaist.ac.jp * rpmforge: apt.sw.be * updates: ftp.jaist.ac.jp addons | 951 B 00:00 base | 1.1 kB 00:00 extras | 2.1 kB 00:00 rpmforge | 1.1 kB 00:00 rpmforge/primary | 2.3 MB 00:10 rpmforge 10737/10737 updates | 1.9 kB 00:00 updates/primary_db | 459 kB 00:00 vz-base | 951 B 00:00 vz-updates | 951 B 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.i386 0:5.0.77-4.el5_6.6 set to be updated --> Processing Dependency: mysql = 5.0.77-4.el5_6.6 for package: mysql-server --> Processing Dependency: perl(DBI) for package: mysql-server --> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: mysql-server --> Processing Dependency: perl-DBI for package: mysql-server --> Processing Dependency: libmysqlclient_r.so.15(libmysqlclient_15) for package: mysql-server --> Processing Dependency: perl-DBD-MySQL for package: mysql-server --> Processing Dependency: libmysqlclient.so.15 for package: mysql-server --> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-server --> Running transaction check ---> Package mysql.i386 0:5.0.77-4.el5_6.6 set to be updated ---> Package perl-DBD-MySQL.i386 0:3.0007-2.el5 set to be updated ---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================== Installing: mysql-server i386 5.0.77-4.el5_6.6 updates 9.8 M Installing for dependencies: mysql i386 5.0.77-4.el5_6.6 updates 4.8 M perl-DBD-MySQL i386 3.0007-2.el5 base 148 k perl-DBI i386 1.52-2.el5 base 600 k Transaction Summary =================================================================================================================================== Install 4 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 15 M Downloading Packages: (1/4): perl-DBD-MySQL-3.0007-2.el5.i386.rpm | 148 kB 00:00 (2/4): perl-DBI-1.52-2.el5.i386.rpm | 600 kB 00:00 (3/4): mysql-5.0.77-4.el5_6.6.i386.rpm | 4.8 MB 00:00 (4/4): mysql-server-5.0.77-4.el5_6.6.i386.rpm | 9.8 MB 00:01 ----------------------------------------------------------------------------------------------------------------------------------- Total 6.0 MB/s | 15 MB 00:02 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-DBI 1/4 Installing : mysql 2/4 Installing : perl-DBD-MySQL 3/4 Installing : mysql-server 4/4 Installed: mysql-server.i386 0:5.0.77-4.el5_6.6 Dependency Installed: mysql.i386 0:5.0.77-4.el5_6.6 perl-DBD-MySQL.i386 0:3.0007-2.el5 perl-DBI.i386 0:1.52-2.el5 Complete
2. 設定ファイル/etc/my.cnfのバックアップを作成します。
# cp -p /etc/my.cnf /etc/my.cnf
3. /etc/my.cnfを編集します。
# vi /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 default-character-set = utf8 ←追加 bind-address=127.0.0.1←追加 # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: # symbolic-links=0 [mysql] ←追加 default-character-set = utf8 ←追加 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
4. 「diff」コマンドで差分の確認と意味を確認し起きましょう。
# diff -c /etc/my.cnf /etc/my.cnf.ORG *** /etc/my.cnf 2011-05-13 15:41:11.000000000 +0900 --- /etc/my.cnf.ORG 2011-05-10 07:21:11.000000000 +0900 *************** *** 5,20 **** # Default to using old password format for compatibility with mysql 3.x # clients (those using the mysqlclient10 compatibility package). old_passwords=1 - default-character-set = utf8 MySQLサーバの文字コードを指定 - bind-address=127.0.0.1 MySQLサーバに接続できるはlocalhost(127.0.0.1)のみ # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: # symbolic-links=0 - [mysql] MySQLクライアントの設定セクション - default-character-set = utf8 MySQLクライアントの文字コードを指定 - [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid --- 5,15 ---- #
5. MySQLサーバを起動します。
初回起動時のみ大量にメッセージが表示しますが、問題はありませんのでご心配なく。
メッセージ内容としては、初期のパスワードが設定されていないし、初期状態からあるテスト用のDBなどもそのままインストールされてしまうので、「/usr/bin/mysql_secure_installation」を実行してくださいとのメッセージなので、次の工程で実行します。
# service mysqld start Initializing MySQL database: Installing MySQL system tables... 110303 20:08:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 110303 20:08:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 OK Filling help tables... 110303 20:08:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 110303 20:08:30 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h ホスト名 password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! The latest information about MySQL is available on the web atSupport MySQL by buying support/licenses at http://shop.mysql.com [ OK ] Starting MySQL: [ OK ] #MySQL
次のページ「MySQlサーバの初期設定」
コメント