RHEL7.x/Centos配置笔记3- from Mysql to Mariadb

https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/

Replication Compatibility

Slave↓ Master→MariaDB-5.5MariaDB-10.0MariaDB-10.1MariaDB-10.2MySQL-5.6MySQL-5.7MySQL-8.0
MariaDB-5.5OkNoNoNoNoNoNo
MariaDB-10.0OkOk  Ok  
MariaDB-10.1OkOkOk Ok  
MariaDB-10.2OkOkOkOkOkOk 
MySQL-5.6    XXX
MySQL-5.7    XXX
MySQL-8.0    XXX

Note X: Refer to MySQL documentation

Note: When replication from MySQL in GTID mode, MariaDB will remove the MySQL GTID events and replace them with MariaDB GTID events.




[root@localhost Packages]# ls |grep maria

mariadb-5.5.44-2.el7.x86_64.rpm
mariadb-bench-5.5.44-2.el7.x86_64.rpm
mariadb-devel-5.5.44-2.el7.i686.rpm
mariadb-devel-5.5.44-2.el7.x86_64.rpm
mariadb-libs-5.5.44-2.el7.i686.rpm
mariadb-libs-5.5.44-2.el7.x86_64.rpm
mariadb-server-5.5.44-2.el7.x86_64.rpm
mariadb-test-5.5.44-2.el7.x86_64.rpm
[root@localhost Packages]# rpm -qa  |grep maria
mariadb-libs-5.5.44-2.el7.x86_64
mariadb-server-5.5.44-2.el7.x86_64
mariadb-5.5.44-2.el7.x86_64
[root@localhost Packages]# ma
machinectl     mailq          mailx          makedeltarpm   man            manpath        mapscrn        
macptopbm      mailq.postfix  make           makedumpfile   mandb          manweb         matchpathcon   
mail           mailstat       makedb         makeinfo       manpage-alert  mapfile        mattrib        
[root@localhost Packages]# rpm -ivh    mariadb-bench-5.5.44-2.el7.x86_64.rpm     mariadb-devel-5.5.44-2.el7.x86_64.rpm        mariadb-test-5.5.44-2.el7.x86_64.rpm  
warning: mariadb-bench-5.5.44-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mariadb-test-1:5.5.44-2.el7      ################################# [ 33%]
   2:mariadb-devel-1:5.5.44-2.el7     ################################# [ 67%]
   3:mariadb-bench-1:5.5.44-2.el7     ################################# [100%]

[root@localhost Packages]# 



lake@localhost:~$ my
myisamchk                   mysqlbinlog                 mysqldumpslow               mysqlshow
myisam_ftdump               mysqlbug                    mysql_find_rows             mysqlslap
myisamlog                   mysqlcheck                  mysql_fix_extensions        mysqltest
myisampack                  mysql_client_test           mysqlhotcopy                mysql_tzinfo_to_sql
my_print_defaults           mysql_config                mysqlimport                 mysql_upgrade
my_safe_process             mysql_convert_table_format  mysql_install_db            mysql_waitpid
mysql                       mysqld_multi                mysql_plugin                mysql_zap
mysqlaccess                 mysqld_safe                 mysql_secure_installation   
mysqladmin                  mysqldump                   mysql_setpermission         
lake@localhost:~$ rpm -qa |grep  mysql 
akonadi-mysql-1.9.2-4.el7.x86_64
php-mysql-5.4.16-36.el7_1.x86_64
pcp-pmda-mysql-3.10.6-2.el7.x86_64
qt-mysql-4.8.5-11.el7.x86_64
 
lake@localhost:~$ rpm -qa |grep  mari
mariadb-devel-5.5.44-2.el7.x86_64
mariadb-libs-5.5.44-2.el7.x86_64
mariadb-server-5.5.44-2.el7.x86_64
mariadb-bench-5.5.44-2.el7.x86_64
mariadb-5.5.44-2.el7.x86_64
mariadb-test-5.5.44-2.el7.x86_64
marisa-0.2.4-3.el7.x86_64
lake@localhost:~$ which mysql 
/usr/bin/mysql
lake@localhost:~$ rpm -qf   /usr/bin/mysql  
mariadb-5.5.44-2.el7.x86_64

lake@localhost:~$ 

lake@localhost:~$  

lake@localhost:~$ sudo  systemctl list-units --type=service   |grep maria
mariadb.service                    loaded active running MariaDB database server
 
lake@localhost:~$ sudo  systemctl start mariadb && systemctl enable mariadb  
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

lake@localhost:~$ 

lake@localhost:~$ netstat -a  --tcp    |grep  mysql 

tcp        0      0 0.0.0.0:mysql           0.0.0.0:*               LISTEN     


lake@localhost:~$ mysql           ########### Default no password for any user DB login
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server


Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> Ctrl-C -- exit!

Aborted


####### security setting 

 lake@localhost:~$ sudo  mysql_secure_installation

/bin/mysql_secure_installation: line 379: find_mysql_client: command not found


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

 
Enter current password for root (enter for none):  <<<<<<<< Enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.


Reload privilege tables now? [Y/n] Y
 ... Success!


### In case, you allow remote mysql login, set in firewall 

# firewall-cmd --permanent --add-service=mysql
success
# firewall-cmd --reload
success

#### Try password login!! 

lake@localhost:~$ mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 5.5.44-MariaDB MariaDB Server


Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


MariaDB [(none)]> select @@version; show databases
+----------------+
| @@version      |
+----------------+
| 5.5.44-MariaDB |
+----------------+
1 row in set (0.00 sec)

 


### Additional setup of security/MysqlDB-mariadb5.x/RHEL7.x, refer to 

https://www.lisenet.com/2016/mariadb-server-with-selinux-on-rhel-7/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值