首页 > 数据库技术 > 详细

MariaDB与MySQL并存

时间:2018-05-21 18:57:18      阅读:31      评论:0      收藏:0      [点我收藏+]

标签:erro   ali   tid   mysqld   安装mysql   -i   SQ   def   been   

以下是MariaDB官方文档说明,MariaDB如何安装在已经存在MySQL实例的主机上:

https://mariadb.com/kb/en/library/installing-mariadb-alongside-mysql/

但是如果是先安装了MariaDB,然后再安装MySQL,比如:

MariaDB的二进制程序在/opt/mysql/mariadb-10.2.8-linux-x86_64/

/usr/local/做了一个软链接,即

ln -s /opt/mysql/mariadb-10.2.8-linux-x86_64/ mysql

具体见《MariaDB安装》的配置是一样的。

安装时注意

新的MySQL实例的配置文件,比如/etc/my3308.cnf,数据等文件设置在/data/mysql/mysql3308/{data,log,tmp}下。
做的软链接是:

ln -s /opt/mysql/mysql-5.7.19-linux-glibc2.12-x86_64/    mysql5.7

初始化MySQL时,一定要指定配置文件!!

cd /usr/local/mysql5.7
./bin/mysqld --defaults-file=/etc/my3308.cnf --initialize

初始化没有报错,但查看日志却发现有error和多个warning,见最后。
其中有一个错误:

[ERROR] Can‘t read from messagefile ‘/opt/mysql/mariadb-10.2.8-linux-x86_64/share/english/errmsg.sys‘

在配置文件,加一个参数即可

[mysqld]
language = /usr/local/mysql5.7/share/english

启动

直接使用绝对路径的mysqld来启动

/usr/local/mysql5.7/bin/mysqld --defaults-file=/etc/my3308.cnf &

关闭

直接使用绝对路径的mysqladmin来关闭

/usr/local/mysql5.7/bin/mysqladmin -S /data/mysql/mysql3308/tmp/mysql3308.sock -uroot -p shutdown

扩展

可以把启动/关闭/登录数据库做成shell文件

启动

echo ‘/usr/local/mysql5.7/bin/mysqld --defaults-file=/etc/my3308.cnf &‘ > start.sh
chmod +x start.sh

关闭

echo ‘/usr/local/mysql5.7/bin/mysqladmin -S /data/mysql/mysql3308/tmp/mysql3308.sock -uroot -p1234567 shutdown‘ > stop.sh
chmod +x stop.sh

登录

echo ‘/usr/local/mysql5.7/bin/mysql -S /data/mysql/mysql3308/tmp/mysql3308.sock -uroot -p1234567‘ > login.sh
chmod +x login.sh

这样就实现了MariaDB和MySQL同一个主机上并存。

不过初始化后,错误日志记录有一些警告的信息:

2017-10-25T10:39:08.325682Z 0 [Warning] The syntax ‘--language/-l‘ is deprecated and will be removed in a future release. Please use ‘--lc-messages-dir‘ instead.
2017-10-25T10:39:08.325842Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-10-25T10:39:08.325937Z 0 [Warning] Using pre 5.5 semantics to load error messages from /usr/local/mysql5.7/share/english/.
2017-10-25T10:39:08.325943Z 0 [Warning] If this is not intended, refer to the documentation for valid usage of --lc-messages-dir and --language parameters.
2017-10-25T10:39:08.326404Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326414Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326478Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326483Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326547Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326550Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326713Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326717Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326784Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326792Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326839Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326843Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.326895Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.326899Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327097Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327108Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327175Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327184Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327373Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327383Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327432Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327439Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327566Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327578Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327673Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327678Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327762Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327766Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327820Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327824Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327870Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327874Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.327968Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.327972Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328017Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328021Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328082Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328086Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328152Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328156Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328216Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328220Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328291Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328296Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
2017-10-25T10:39:08.328341Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import‘
2017-10-25T10:39:08.328345Z 0 [Warning] Unknown LDML tag: ‘charsets/charset/collation/rules/import/source‘
 100
 100
 100
2017-10-25T10:39:08.912076Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-10-25T10:39:08.965834Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-10-25T10:39:09.024512Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: bb700150-b970-11e7-8e66-0050568a571f.
2017-10-25T10:39:09.025193Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2017-10-25T10:39:09.026291Z 1 [Note] A temporary password is generated for root@localhost: eiq-<*>yO0k-

MariaDB与MySQL并存

标签:erro   ali   tid   mysqld   安装mysql   -i   SQ   def   been   

原文:https://www.cnblogs.com/fishparadise/p/9068511.html

(0)
(0)
   
举报
评论 一句话评论(0
0条  
登录后才能评论!
© 2014 bubuko.com 版权所有 鲁ICP备09046678号-4
打开技术之扣,分享程序人生!
             

鲁公网安备 37021202000002号