MySQL > CentOS5にMySQL5.0をyumでインストール
更新日
2012-02-24
広告
yumを使って、CentOSにMySQLを普通にインストールする方法を紹介します。私の環境では、MySQLのバージョン5.0.xがインストールされました。
- OS: CentOS 5.7
インストールする前に、アーキテクチャを調べておきましょう。x86_64か、i386か、が重要です。
$ uname -m x86_64私の環境は x86_64 でした。なので、x86_64のMySQLをインストールします。
$ sudo yum install mysql.x86_64 $ sudo yum install mysql-server.x86_64/usr/share/mysql以下に設定ファイルなどがインストールされます。実体である mysqld は /usr/libexec 以下にインストールされます。
システム規模に応じた設定ファイルが /usr/share/mysql/ 以下にインストールされています。今回は、大規模環境用の設定ファイル(my-huge.cnf)を使います。
$ sudo cp /etc/my.cnf /etc/my.cnf.orig # 一応、デフォルトのファイルをバックアップ $ sudo cp /usr/share/mysql/my-huge.cnf /etc/my.cnfあとは、必要に応じて、 /etc/my.cnf に設定を追加します。
起動は、rootユーザになって行います。
$ sudo /etc/rc.d/init.d/mysqld start Initializing MySQL database: Installing MySQL system tables... OK Filling help tables... 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 sample.com 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 at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com [ OK ] Starting MySQL: [ OK ]初回起動時は、上記のメッセージが表示されます。
メッセージにあるように、rootユーザのパスワードを設定します。
$ mysqladmin -u root password 'hogehogehoge'
これで、ログインできるようになったはずです。例えば、以下のようなコマンドでよいはず。
$ mysql -u root -p
広告
お問い合わせは sweng.tips@gmail.com まで。