[Linux]CentOS6.3にMysqlを導入する
・インストール
# yum install mysql-server
1 2 3 4 5 6 7 8 9 |
Dependencies Resolved ======================================================= Package Arch Version Repository Size ======================================================= Installing: mysql-server x86_64 5.1.67-1.el6_3 updates 8.6 M Installing for dependencies: mysql x86_64 5.1.67-1.el6_3 updates 886 k perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k |
# cd /etc
# cp my.cnf my.cnf.org
# vi my.cnf
# Addition kumakake
[mysqld]
old_passwords=1
#default-character-set=utf8
character-set-server=utf8
skip-character-set-client-handshake
# Addition kumakake
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqldump]
default-character-set=utf8
# chkconfig –list mysqld
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# chkconfig mysqld on
# chkconfig –list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# /etc/rc.d/init.d/mysqld start
MySQL データベースを初期化中: 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 cent.localdomain 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 /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
mysqld を起動中: [ OK ]
・データベースの文字コードを確認する
※ダミーでhogeデータベースを作成して確認する
# mysql -u root
mysql> create database hoge;
mysql> use hoge
mysql> show variables like “char%”;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
+--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) |
以上です。