安装和配置Mariadb
看来以后不得不使用Mariadb数据库了,尽早的熟悉;
[1]Install Mariadb for epel
yum -y install mariadb-server
Installed:
mariadb-server.x86_64 1:5.5.37-1.el7_0
[2]Start Mariadb & 开机启动
[root@mariadb ~]# systemctl start mariadb [root@mariadb ~]# systemctl enable mariadb ln -s ‘/usr/lib/systemd/system/mariadb.service‘ ‘/etc/systemd/system/multi-user.target.wants/mariadb.service‘
[3]Configure Mariadb
[root@mariadb ~]# mysql -uroot Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
#show info
MariaDB [(none)]> select user,host,password from mysql.user; +------+------------------+----------+ | user | host | password | +------+------------------+----------+ | root | localhost | | | root | mariadb.carso.cn | | | root | 127.0.0.1 | | | root | ::1 | | | | localhost | | | | mariadb.carso.cn | | +------+------------------+----------+ 6 rows in set (0.00 sec)
#设置root password
MariaDB [(none)]> set password for root@localhost=password(‘123.com‘); Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> set password for root@mariadb.carso.cn=password(‘123.com‘); Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> set password for root@127.0.0.1=password(‘123.com‘); Query OK, 0 rows affected (0.00 sec)
#::1这个是ipv6用户,如果用不到可以删除
MariaDB [(none)]> delete from mysql.user where user=‘root‘ and host=‘::1‘; Query OK, 1 row affected (0.00 sec)
#安全考虑,删除匿名用户
MariaDB [(none)]> delete from mysql.user where user=‘‘; Query OK, 2 rows affected (0.01 sec)
#show info
MariaDB [(none)]> select user,host,password from mysql.user; +------+------------------+-------------------------------------------+ | user | host | password | +------+------------------+-------------------------------------------+ | root | localhost | *AC241830FFDDC8943AB31CBD47D758E79F7953EA | | root | mariadb.lisys.cn | *AC241830FFDDC8943AB31CBD47D758E79F7953EA | | root | 127.0.0.1 | *AC241830FFDDC8943AB31CBD47D758E79F7953EA | +------+------------------+-------------------------------------------+ 3 rows in set (0.00 sec)
[4]验证设置
MariaDB [(none)]> exit Bye
[root@mariadb ~]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 5.5.37-MariaDB MariaDB Server Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]> exit Bye
本文出自 “西伯利亚·狼” 博客,请务必保留此出处http://kernal.blog.51cto.com/8136890/1531271