開発環境のMySQLを4系から5系に変更する方法(开发环境 升级MySQL4到MySQL5)

4 篇文章 0 订阅
4 篇文章 0 订阅
只是升级数据库的话,参照另一篇文章

 http://blog.csdn.net/wwlike2002/archive/2009/09/29/4617216.aspx


(1) 稼動中のMySQLサーバーをシャットダウン(关闭运行中的MySQL服务器)
[root@dhcp157 ~]# mysqladmin -uroot -p shutdown


(2) mysql4の自動起動を確認、停止および削除(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 -y update


(5) mysql4.0.27をアンインストール(卸载旧版本mysql)
[root@dhcp157 ~]# cd /root/src/mysql-4.0.27/
[root@dhcp157 mysql-4.0.27]# make uninstal
[root@dhcp157 ~]# cd ~


(6) インストールするmysql5のバージョンを確認(确认要安装的新版本mysql)
[root@dhcp157 ~]# yum search mysql-server


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


(8) インストールしたパッケージを確認(安装后确认)
[root@dhcp157 ~]# yum list installed | 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) 権限テーブルを再作成(重新构造mysql的权限表)
[root@dhcp157 ~]# mysql_install_db


(11) phpをリコンパイルするためにmysql-develをインストール(已经有php的话,需要执行下面的命令)
[root@dhcp157 ~]# yum -y install mysql-devel.i386 5.0.82sp1-1.el4_8


(12) インストールしたパッケージを確認(确认版本)
[root@dhcp157 ~]# yum list installed | grep mysql


(13) mysqlを自動的に起動するように設定(将mysql服务设置成随系统启动)
[root@dhcp157 ~]# chkconfig mysqld on
[root@dhcp157 ~]# chkconfig --list mysqld


(14) phpのモジュールの依存関係を解消するためにphpをリコンパイル(重新编译php,消除依赖于php的模块的关联)
[root@dhcp157 ~]# cd /root/src/php-4.3.11
[root@dhcp157 php-4.3.11]# make distclean
[root@dhcp157 php-4.3.11]# './configure' '--with-config-file-path=/usr/local/lib' '--with-apxs=/usr2/apache/bin/apxs' '--with-mysql=/usr' '--with-pcre-regex' '--with-zlib' '--with-openssl' '--enable-ftp' '--enable-pear' '--enable-memory-limit' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring' '--enable-mbregex' '--enable-zend-multibyte' '--enable-sigchild' '--enable-track-vars' '--disable-ipv6' '--with-mcrypt' '--with-iconv' '--with-mhash' '--enable-versioning' '--enable-memcache' '--with-dom'
[root@dhcp157 php-4.3.11]# make
[root@dhcp157 php-4.3.11]# make install
[root@dhcp157 ~]# cd ~


(15) apacheを再起動(启动apache)
[root@dhcp157 ~]# /etc/rc.d/init.d/httpd restart


(16) MySQLサーバを起動(启动MySQL)
[root@dhcp157 ~]# /etc/rc.d/init.d/mysqld start


(17) MySQLサーバーバーションを確認(确认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 |
+-----------+

(18) MySQLサーバの文字コードを確認(确认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/ |
+--------------------------+----------------------------+

(19) 必要であればphp.iniを本番環境に合わせる
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值