阿里云Centos6.X安装mysql5.5.X

来源:互联网 发布:天津seo 页面优化 编辑:程序博客网 时间:2024/06/01 13:43



PS:MySQL 5.5系列成为稳定版已经有一段时间了,但据我调查了解,在生产环境中还是以5.1系列为主。在国内的大公司里,只确定金山在使用5.5了。

公司的其中几台广告统计服务器,之前的运维直接用了自带安装的MySQL 5.0系列。新来的程序员写了新的广告统计程序,使用了innodb存储引擎,偶发现5.0对innodb引擎支持不怎么好,数据库并发连接数多时会出现丢连接,于是就想升级到5.5试试。因已安装了5.0,所以不想编译安装了。就直接找了一个国外编译好的5.5的yum源,直接升级,跑了一个月了,发现很稳定!就分享一下:

1、安装MySQL 5.5.x的yum源:
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

2、安装MySQL客户端的支持包:
yum install libmysqlclient15 --enablerepo=webtatic

3、卸载MySQL老版本的软件包:
yum remove mysql mysql-*

4、安装MySQL 5.5的客户端和服务端:
yum install mysql55 mysql55-server --enablerepo=webtatic

执行出现报错

Error: mysql55w-libs conflicts with mysql-libs-5.1.73-3.el6_5.x86_64

 You could try using --skip-broken to work around the problem

 You could try running: rpm -Va --nofiles --nodigest

MySQL-shared-compat-6.0.11-0.glibc23.x86_64.rpm参照搜索

wget http://anlongtechnology.com:8894/src/MySQL-shared-compat-6.0.11-0.glibc23.x86_64.rpm


yum install yum-plugin-replace    此命令无法安装yum replace mysql-libs --replace-with mysql55w-libsyum install mysql55w mysql55w-server


5、启动MySQL系统服务,更新数据库:

/etc/init.d/mysqld restart

[root@iZ9435byih4Z src]# mysql -v

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

[root@iZ9435byih4Z src]# /etc/init.d/mysqld restart

Stopping mysqld:                                           [  OK  ]

Initializing MySQL database:  Installing MySQL system tables...

OK

Filling help tables...

OK


To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:


/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h iXXXXXXXXXX password 'new-password'


Alternatively you can run:

/usr/bin/mysql_secure_installation


which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl

cd /usr/mysql-test ; perl mysql-test-run.pl


Please report any problems at http://bugs.mysql.com/


                                                           [  OK  ]

Starting mysqld:                                           [  OK  ]




mysql_upgrade

6、附:此台服务器的my.cnf配置

skip-locking
skip-name-resolve
key_buffer = 1024M
back_log = 3000
max_allowed_packet = 4M
table_cache = 512
sort_buffer_size = 8M
read_buffer_size = 8M
myisam_sort_buffer_size = 1024M
thread_cache = 512
query_cache_size = 512M
set-variable = wait_timeout=60
thread_concurrency = 4
log-slow-queries = slow.log
long_query_time = 1
innodb_flush_log_at_trx_commit = 2
innodb_buffer_pool_size = 1024M
#innodb_locks_unsafe_for_binlog = 1

如果不是升级,而是新安装。还需要设置root密码,删除默认的空用户、空密码等等,这里就不说了。请参考本博其他博文或官方手册,或者google。

设置root密码 /usr/bin/mysqladmin -u root password 'XXXXX'


0 0
原创粉丝点击