開発環境のMySQLを4系から5系に変更する方法

(1)稼動中のMySQLサーバーをシャットダウンします
mysqladmin -uroot -p shutdown

(2)mysql4の自動起動を確認、停止および削除
[root@dhcp157 ~]# chkconfig --list mysql.server
[root@dhcp157 ~]# chkconfig mysql.server off
[root@dhcp157 ~]# chkconfig --del mysql.server


(3)以下のファイルを修正
[root@dhcp157 ~]# vi /etc/yum.repos.d/CentOS-Base.repo

------------------------------------------------------
For [base] and [update], add the line

enabled=0

For [centosplus], set

enabled=1
------------------------------------------------------


(4)パッケージマネージャを更新します
[root@dhcp157 ~]# yum update

Is this ok [y/N]:

yを入力します


(5)インストールしようとするmysql5のバージョンを確認します
[root@dhcp157 ~]# yum search mysql-server


(6)mysql4をアンインストールします
[root@dhcp157 ~]# cd /root/src/mysql-4.0.27/
[root@dhcp157 mysql-4.0.27]# make uninstall


(7)mysql5をンストールします
[root@dhcp157 ~]# yum install mysql-server.i386 5.0.82sp1-1.el4_8
※上記の「5.0.82sp1-1.el4_8」はバージョン番号です。

Is this ok [y/N]:

yを入力します

(8)インストールしたパッケージを確認します
[root@dhcp157 ~]# yum list installed | grep mysql
または
[root@dhcp157 ~]# rpm -qa | grep mysql

(9)正常にインストールした後、my.cnfを修正します
[root@dhcp157 ~]# vi /etc/my.cnf

[client]
socket=/var/lib/mysql/mysql.sock
default-character-set=utf8

[mysqld]
old_passwords=1 → #old_passwords=1      (コメントアウト)



default-character-set=utf8
skip-character-set-client-handshake


(10)以下のようなコマンドを実行して権限テーブルを作成し直す
[root@dhcp157 mysql]# mysql_install_db

(11)MySQLサーバを起動します
[root@dhcp157 mysql]# /etc/rc.d/init.d/mysqld start

(12)MySQLサーバーバーションを確認します
[root@dhcp157 ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 2 to server version: 5.0.82sp1

Type 'help;' or '/h' for help. Type '/c' to clear the buffer.

mysql> select version();
+------------+
| version() |
+-----------+
| 5.0.82sp1 |
+-----------+

(13)MySQLサーバの文字コードを確認します
mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值