安裝和配置Mariadbmysql
看來之後不得不使用Mariadb數據庫了,儘早的熟悉;
sql
[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 & 開機啓動bash
[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 Mariadbide
[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 infoserver
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 passwordip
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用戶,若是用不到能夠刪除get
MariaDB [(none)]> delete from mysql.user where user='root' and host='::1'; Query OK, 1 row affected (0.00 sec)
#安全考慮,刪除匿名用戶input
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.cason.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