LoginSignup
0
0

More than 1 year has passed since last update.

MySQLバージョンアップ

Posted at

現在のバージョン確認

mysql --version

mysql5.5系→5.7系へのバージョンアップ

sudo service mysqld stop 
sudo yum -y remove mysql-config mysql55-server mysql55-libs mysql55  
sudo yum -y install mysql57-server mysql57     

mysql --version 

sudo service mysqld start

動作状況確認

service mysqld status

停止コマンド

sudo service mysqld stop

ルートユーザーでログイン

mysql -u root

文字コードの確認

show variables like '%char%';

(latin1が含まれている場合、日本語が文字化けするので変更する必要がある)

設定ファイルの確認

less /etc/my.cnf

設定ファイルのバックアップ取得

sudo cp /etc/my.cnf /etc/my.cnf.bk

設定ファイルの編集

sudo vim /etc/my.cnf

[mysqld_safe]の直前行に
character-set-server = utf8
と入力

mysqlの再起動

sudo service mysqld restart

文字コードがutf8に変わっているのを確認

(character_set_filesystemとcharacter_sets_dir以外)

自動起動設定

sudo chkconfig mysqld on

状態確認

sudo chkconfig | grep mysql

サーバ再起動

sudo reboot

再度service mysqld statusを行い、
mysqld (pid 2948) is running...となっていればOK

新規ユーザー作成(ルートユーザーでログイン中のみ可能)

create user <dbuser01>@<localhost> identified by '<password>';
grant all on <db01>.* to <dbuser01>@<localhost>;

ドキュメント(mysql5.6の日本語リファレンス)必要に応じて参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0