Rootop 服务器运维与web架构

centos6.5下yum安装mariadb

| 暂无评论

从https://downloads.mariadb.org/mariadb/repositories/找到你的系统版本
并且可以选择数据库版本。
一般平常用的版本,rhel5/6、centos5/6
我这里选择MariaDB5.5,以下是centos6.5_x64的yum仓库信息:
# MariaDB 5.5 CentOS repository list - created 2014-05-02 10:28 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

保存为MariaDB.repo放到/etc/yum.repos.d/下。
安装:
[root@centos-6.5-x64 ~]#yum install -y MariaDB-server MariaDB-client
[root@centos-6.5-x64 ~]#service mysql start #是mysql不是mysqld
[root@centos-6.5-x64 ~]#lsof -i:3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 4347 mysql 14u IPv4 17716 0t0 TCP *:mysql (LISTEN)
其它操作跟mysql一样。

修改MariaDB数据库编码:
MariaDB [(none)]> show variables like "chara%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.12 sec)

先看下配置文件:
[root@centos-6.5-x64 ~]#cat /etc/my.cnf | grep -v "^$" | grep -v "#"
[client-server]
!includedir /etc/my.cnf.d
发现从/etc/my.cnf.d配置目录下加载所有文件。
[root@centos-6.5-x64 ~]#vi /etc/my.cnf.d/server.cnf
在[mysqld]段添加
character_set_server = utf8

以前是default-character-set现在在MariaDB不同于mysql。
重启mysql服务。
MariaDB [(none)]> show variables like "chara%";
+--------------------------+----------------------------+
| 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/ |
+--------------------------+----------------------------+
8 rows in set (0.28 sec)

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/2482.html

作者:Venus

服务器运维与性能优化

发表回复