mysqlの導入
mysql構築なんて腐るほどあると思うけど、
自分なりに構築した備忘録
■mysqlの導入
yum install mysql-server yum install mysql-devel
文字コードをUTF8にする
rails new 名前 -d mysql
でmysqlが適用アプリケーションが作成できる
■文字コードの変更
mv /etc/my.cnf /etc/my.cnf.d vi /etc/my.cnf
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock character-set-server=utf8 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used (fedora >= 15). # If you need to run mysqld under a different user or group, # customize your systemd unit file for mysqld according to the # instructions in http://fedoraproject.org/wiki/Systemd user=mysql # Semisynchronous Replication # http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html # uncomment next line on MASTER ;plugin-load=rpl_semi_sync_master=semisync_master.so # uncomment next line on SLAVE ;plugin-load=rpl_semi_sync_slave=semisync_slave.so # Others options for Semisynchronous Replication ;rpl_semi_sync_master_enabled=1 ;rpl_semi_sync_master_timeout=10 ;rpl_semi_sync_slave_enabled=1 # http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html ;performance_schema # # include all files from the config directory # #!includedir /etc/my.cnf.d [mysql] default-character-set=utf8 [mysqldump] default-character-set=utf8
■確認
mysql -u root -p
■全ての権限を持つユーザの作成
mysql> GRANT ALL ON *.* TO ユーザID@"localhost"IDENTIFIED BY "パスワード"; mysql> FLUSH PRIVILEGES;
■ユーザの確認
mysql> SELECT host,user FROM mysql.user;
■起動時立ち上がるように設定
sudo chkconfig --level 35 mysqld on
■一言
地味に文字コードの設定ではまるので書き溜めとく