当前位置:Gxlcms > mysql > Centos上用YUM方式安装mysql衍生发行版PerconaServer

Centos上用YUM方式安装mysql衍生发行版PerconaServer

时间:2021-07-01 10:21:17 帮助过:16人阅读

? ?? 前言 MySQL衍生版 Percona Server的更多资料请搜索~ 对于如今mysql在甲骨文的掌控下,最为开源软件来说前景堪忧~ mysql的衍生版倒是有几个,这些东西到底能不能用? 红薯都用percona作为oschina的生产数据库了。我也不怕了!哈哈,上!坚决的上!因为我

? ??前言

MySQL衍生版 Percona Server的更多资料请搜索~ 对于如今mysql在甲骨文的掌控下,最为开源软件来说前景堪忧~ mysql的衍生版倒是有几个,这些东西到底能不能用? 红薯都用percona作为oschina的生产数据库了。我也不怕了!哈哈,上!坚决的上!因为我是先拿vps小内存的环境开刀(搞熟悉了上生产线),所以centos6系统为32位滴,那么64位、centos5等等,如法炮制即可~

对?Percona Server?的担忧,使用这个不会出问题吧,是不是和mysql都不一样。不用担心,mysql怎么用你他就怎么用,配置也是一样的。

? ? 安装

对于用源码编译安装,和用rpm安装的利弊,我这样理解。如果你需要进行二次开发、修改、定制化,那么你就选择源码编译安装。如果你就是用用,那么直接yum吧骚年,难道你要rpm一个一个手动安装?ok那也行。

如果你是32位

[root@s1 ~]# rpm -Uhv?http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm

如果你是64位

[root@s1 ~]# rpm -Uhv?http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

检查下

[root@s1 ~]# yum list |grep percona

percona-release.i386 0.0-1 installed

Percona-SQL-50-debuginfo.i686 5.0.92-b23.88.rhel6 percona

Percona-SQL-client-50.i686 5.0.92-b23.88.rhel6 percona

Percona-SQL-devel-50.i686 5.0.92-b23.88.rhel6 percona

Percona-SQL-server-50.i686 5.0.92-b23.88.rhel6 percona

Percona-SQL-shared-50.i686 5.0.92-b23.88.rhel6 percona

Percona-SQL-shared-compat.i686 5.0.92-b23.85.rhel6 percona

Percona-SQL-test-50.i686 5.0.92-b23.88.rhel6 percona

Percona-Server-51-debuginfo.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-55-debuginfo.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-client-51.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-client-55.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-devel-51.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-devel-55.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-server-51.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-server-55.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-shared-51.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-shared-55.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-shared-compat.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-Server-test-51.i686 5.1.66-rel14.2.501.rhel6 percona

Percona-Server-test-55.i686 5.5.28-rel29.3.388.rhel6 percona

Percona-XtraDB-Cluster-client.i686 1:5.5.28-23.7.369.rhel6 percona

Percona-XtraDB-Cluster-debuginfo.i686 1:5.5.28-23.7.369.rhel6 percona

Percona-XtraDB-Cluster-devel.i686 1:5.5.28-23.7.369.rhel6 percona

Percona-XtraDB-Cluster-galera.i686 2.0-1.117.rhel6 percona

2.0-1.117.rhel6 percona

Percona-XtraDB-Cluster-server.i686 1:5.5.28-23.7.369.rhel6 percona

Percona-XtraDB-Cluster-shared.i686 1:5.5.28-23.7.369.rhel6 percona

Percona-XtraDB-Cluster-test.i686 1:5.5.28-23.7.369.rhel6 percona

percona-playback.i686 0.5-2.el6 percona

percona-playback-debuginfo.i686 0.5-2.el6 percona

percona-playback-devel.i686 0.5-2.el6 percona

percona-toolkit.noarch 2.1.8-1 percona

percona-xtrabackup.i686 2.0.4-484.rhel6 percona

percona-xtrabackup-debuginfo.i686 2.0.4-484.rhel6 percona

percona-xtrabackup-test.i686 2.0.4-484.rhel6 percona

[root@s1 ~]#

这样已经成功了,开始yum吧。里面有很多很多东东呢,还有备份工具什么的。还有不同的版本。选你需要的包。

这里一定要安装 Percona-Server-shared-compat 包,否则会报错的。

Running Transaction Test

Transaction Check Error:

file /usr/lib/libmysqlclient.so conflicts between attempted installs of Percona-Server-shared-51-5.1.66-rel14.2.501.rhel6.i686 and Percona-Server-shared-55-5.5.28-rel29.3.388.rhel6.i686

file /usr/lib/libmysqlclient_r.so conflicts between attempted installs of Percona-Server-shared-51-5.1.66-rel14.2.501.rhel6.i686 and Percona-Server-shared-55-5.5.28-rel29.3.388.rhel6.i686

Error Summary

————-

? ??yum需要的包

[root@s1 ~]#?yum install Percona-Server-shared-compat Percona-Server-client-55 Percona-Server-server-55 Percona-Server-shared-55 Percona-Server-test-55 ?percona-xtrabackup*

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 s1.us.iamle.com 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.

Please report any problems with the /usr/bin/mysqlbug script!

Percona recommends that all production deployments be protected with a support

contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,

be eligible for hot fixes, and boost your team’s productivity.

Percona Server is distributed with several useful UDF (User Defined Function) from Maatkit.

Run the following commands to create these functions:

mysql -e “CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME ‘libfnv1a_udf.so’”

mysql -e “CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME ‘libfnv_udf.so’”

mysql -e “CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME ‘libmurmur_udf.so’”

See http://code.google.com/p/maatkit/source/browse/trunk/udf for more details

Installing : Percona-Server-shared-compat-5.5.28-rel29.3.388.rhel6.i686 6/6

Verifying : Percona-Server-server-55-5.5.28-rel29.3.388.rhel6.i686 1/6

Verifying : Percona-Server-shared-compat-5.5.28-rel29.3.388.rhel6.i686 2/6

Verifying : percona-xtrabackup-test-2.0.4-484.rhel6.i686 3/6

Verifying : Percona-Server-shared-55-5.5.28-rel29.3.388.rhel6.i686 4/6

Verifying : percona-xtrabackup-2.0.4-484.rhel6.i686 5/6

Verifying : Percona-Server-client-55-5.5.28-rel29.3.388.rhel6.i686 6/6

Installed:

Percona-Server-client-55.i686 0:5.5.28-rel29.3.388.rhel6

Percona-Server-server-55.i686 0:5.5.28-rel29.3.388.rhel6

Percona-Server-shared-55.i686 0:5.5.28-rel29.3.388.rhel6

Percona-Server-shared-compat.i686 0:5.5.28-rel29.3.388.rhel6

percona-xtrabackup.i686 0:2.0.4-484.rhel6

percona-xtrabackup-test.i686 0:2.0.4-484.rhel6

Complete!

到这里就已经成功了。

启动

/etc/init.d/mysql start

初始root密码为空,执行mysql_secure_installation进行初始化root操作·

mysql_secure_installation

设置root密码

/usr/bin/mysqladmin -u root password ‘new-password’

或者

/usr/bin/mysqladmin -u root -h s1.us.iamle.com password ‘new-password’

设置msyql安全,去掉远程登录等。密码为刚刚设置的密码。

/usr/bin/mysql_secure_installation

? ??Percona(mysql)配置文件

? ? ?my.cnf

可以通过percona官网在线生成percona(mysql) 配置文件my.cnf?https://tools.percona.com/?。强烈推荐,简单、快捷、可靠。 percona通过yum安装的rpm包默认没有my.cnf文件在 /etc/my.cnf 。vi /etc/my.cnf 加入生成的配置即可。 数据库默认路径 /var/lib/mysql/ 。

ps:如果你在配置文件中改变了/var/lib/mysql/路径,请mv过去。搞错data目录是无法启动的。

会报错

[root@s1 mysql]# /etc/init.d/mysql start

Starting MySQL (Percona Server)… ERROR! The server quit without updating PID file (/home/mysql/data//s1.us.iamle.com.pid).

? ??默认字符集

二进制安装的percona默认的字符集为latin1 ,这里我们需要为utf8,percona官网生产的配置文件没有指定字符集的,需要自己手动配置到my.cnf文件中。

# CLIENT #
#修改客户端默认字符编码格式为utf8
default-character-set=utf8

# GENERAL #
#修改服务器端默认字符编码格式为utf8

character_set_server=utf8

#重启mysql后在查询中查看当前字符集~

show variables like ‘character%’;

show variables like ‘collation%’;

#查看所有字符集

show character set;

如果以上都做了,数据库也设置为utf8了,但是还是会乱码。

那么直接在SQL文件的最前面加上:
SET NAMES ‘utf8′;

它相当于下面的三句指令:
SET character_set_client = utf8;
SET character_set_results = utf8;
SET character_set_connection = utf8;

? ??启动 percona(mysql)

和mysql完全一样,停止和重启也如法炮制

service mysql start

或者

/etc/init.d/mysql start

? ??扩展阅读

使用 Yum 安装 Percona Server

Percona Server 启用 HandlerSocket 插件

请问oschina现在用的是mysql还是Percona,什么存储引擎?

Percona?yum?Repository?官网原文

building mysql 5.5.8 with default charset

Linux下MySQL 5.5的修改字符集编码为UTF8(彻底解决中文乱码问题)

无觅相关文章插件,快速提升流量

人气教程排行