(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/ |
+--------------------------+----------------------------+
開発環境のMySQLを4系から5系に変更する方法
最新推荐文章于 2024-08-06 17:49:28 发布