一、centos7下mysql 安装配置
yum -y install mariadb*
systemctl start mariadb.service
systemctl enable mariadb.service
二、初始化
1 [root@web]#mysql 2 Welcome to the MariaDB monitor. Commands end with ; or \g. 3 Your MariaDB connection id is 3 4 Server version: 5.5.50-MariaDB MariaDB Server 5 6 Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. 7 8 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 9 10 MariaDB [(none)]> use mysql 11 Reading table information for completion of table and column names 12 You can turn off this feature to get a quicker startup with -A 13 14 Database changed 15 MariaDB [mysql]> show databases; 16 MariaDB [mysql]> show databases; 17 +--------------------+ 18 | Database | 19 +--------------------+ 20 | information_schema | 21 | mysql | 22 | performance_schema | 23 | test | 24 +--------------------+ 25 4 rows in set (0.00 sec) 26 27 MariaDB [mysql]> use mysql 28 Database changed 29 MariaDB [mysql]> update user set password=PASSWORD('cXP123456') where user='root'; #设置密码 30 Query OK, 4 rows affected (0.00 sec) 31 Rows matched: 4 Changed: 4 Warnings: 0 32 33 MariaDB [mysql]> flush privileges 34 -> ; 35 Query OK, 0 rows affected (0.01 sec) 36 37 MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'cXP123456'; #设置远程登录 38 Query OK, 0 rows affected (0.00 sec) 39 40 MariaDB [mysql]> flush privileges; 41 Query OK, 0 rows affected (0.00 sec) 42 43 MariaDB [mysql]> exit 44 Bye