今天在一台CentOS6.4的vps上执行了yum update -y,由于用第三方软件源结果mysql自动升级为了mariadb。
网上查了一下,mariadb是mysql的分支版本,开发小组的一些成员就是mysql开发小组的成员,主要由社区在维护,采用GPL授权许可。同样支持MyISAM引擎和InnoDB引擎。感觉开源社区打算逐步用mariadb来代替mysql。
更新后,在/etc目录下会生成my.cnf.rpmnew。
由于使用以前的配置文件会报错,所以要手动修改新的配置文件。
1、
mv /etc/my.cnf /tmp
mv /etc/my.cnf.rpmnew /etc/my.cnf
vim /etc/my.cnf
2、
在[mysqld_safe]前添加以下内容:
skip-external-locking
skip-name-resolve
skip-networking
key_buffer_size = 32M
max_allowed_packet = 2M
table_cache = 64
sort_buffer_size = 1M
net_buffer_length = 8K
read_buffer_size = 1M
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 16M
loose-skip-innodb
default-storage-engine = MyISAM
3、
重启mysql服务:
service mysqld restart
4、
查看日志有无错误:
tail /var/log/mysqld.log
发现有错误:
130515 22:24:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130515 22:24:16 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130515 22:24:16 [Note] Plugin 'InnoDB' is disabled.
130515 22:24:16 [Note] Plugin 'FEEDBACK' is disabled.
130515 22:24:16 [Warning] 'proxies_priv' entry '@ root@server01.com' ignored in --skip-name-resolve mode.
130515 22:24:16 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A
130515 22:24:16 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
130515 22:24:16 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.30-MariaDB-debug' socket: '/var/lib/mysql/mysql.sock' port: 0 MariaDB Server
5、执行升级命令
mysql_upgrade -u root -p
输入密码后会自动升级数据表。
再次重启mysql查看日志:
service mysqld restart
tail /var/log/mysqld.log
130515 22:33:05 [Note] /usr/libexec/mysqld: Normal shutdown
130515 22:33:05 [Note] /usr/libexec/mysqld: Shutdown complete
130515 22:33:05 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130515 22:33:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130515 22:33:06 [Note] Plugin 'InnoDB' is disabled.
130515 22:33:06 [Note] Plugin 'FEEDBACK' is disabled.
130515 22:33:06 [Warning] 'proxies_priv' entry '@ root@server01.com' ignored in --skip-name-resolve mode.
130515 22:33:06 [Note] Event Scheduler: Loaded 0 events
130515 22:33:06 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.30-MariaDB-debug' socket: '/var/lib/mysql/mysql.sock' port: 0 MariaDB Server
增加开机启动项:
chkconfig --add mysqld
chkconfig --level 345 mysqld on
参考资料:
https://mariadb.atlassian.net/i#browse/MDEV-4188
(责任编辑:IT) |