Subscribe:

2010/10/04

mysql インストール(さくらVPSサーバー)


インストール

[root@centos]# yum -y install mysql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: ftp.nara.wide.ad.jp * base: ftp.nara.wide.ad.jp * extras: ftp.nara.wide.ad.jp * updates: ftp.nara.wide.ad.jp addons | 951 B 00:00 base | 2.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.x86_64 0:5.0.77-4.el5_5.3 set to be updated --> Processing Dependency: perl-DBD-MySQL for package: mysql-server --> Running transaction check ---> Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ========================================================================================== Package Arch Version Repository Size ========================================================================================== Installing: mysql-server x86_64 5.0.77-4.el5_5.3 updates 9.8 M Installing for dependencies: perl-DBD-MySQL x86_64 3.0007-2.el5 base 148 k Transaction Summary ========================================================================================== Install 2 Package(s) Upgrade 0 Package(s) Total download size: 10 M Downloading Packages: (1/2): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00 (2/2): mysql-server-5.0.77-4.el5_5.3.x86_64.rpm | 9.8 MB 00:00 ------------------------------------------------------------------------------------------ Total 15 MB/s | 10 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : perl-DBD-MySQL 1/2 Installing : mysql-server 2/2 Installed: mysql-server.x86_64 0:5.0.77-4.el5_5.3 Dependency Installed: perl-DBD-MySQL.x86_64 0:3.0007-2.el5 Complete! [root@centos]# su - [root@ ~]# chkconfig mysqld on [root@ ~]# chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@ ~]# exit logout [root@centos]# /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 wwwXXXXu.sakura.ne.jp 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 ]

mysqlユーザーとパスワード設定

[root@centos]# mysql -u root -h localhost rootでログイン Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.77 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set password for root@localhost=password('パスワード'); Query OK, 0 rows affected (0.00 sec) mysql> set password for root@'www4173u.sakura.ne.jp'=password('パスワード'); Query OK, 0 rows affected (0.01 sec) mysql> set password for root@127.0.0.1=password('パスワード'); Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on *.* to centos@localhost identified by 'パスワード'; Query OK, 0 rows affected (0.00 sec) mysql> select user,host,password from mysql.user; +--------+-----------------------+------------------+ | user | host | password | +--------+-----------------------+------------------+ | root | localhost | 123456789abcdef0 | | root | www4173u.sakura.ne.jp | 123456789abcdef0 | | root | 127.0.0.1 | 123456789abcdef0 | | | localhost | | | | www4173u.sakura.ne.jp | | | centos | localhost | 123456789abcdef0 | +--------+-----------------------+------------------+ 6 rows in set (0.00 sec) mysql> quit Bye [root@centos]# mysql -u centos -pパスワード Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.0.77 Source 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 | 123456789abcdef0 | | root | www4173u.sakura.ne.jp | 123456789abcdef0 | | root | 127.0.0.1 | 123456789abcdef0 | | | localhost | | | | www4173u.sakura.ne.jp | | | centos | localhost | 123456789abcdef0 | +--------+-----------------------+------------------+ 6 rows in set (0.01 sec) mysql> quit Bye [root@centos]#

0 件のコメント: