查看初始化结果:
# ls /data/mysql/3306/data/
aria_log.00000001 ibdata1 ib_logfile1 mysql-bin.000001 mysql-bin.000003 mysql-bin.state test
aria_log_control ib_logfile0 mysql mysql-bin.000002 mysql-bin.index performance_schema 8.启动服务
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod +x /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# service mysqld start 9.添加环境变量
# vim /etc/profile
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin
重读环境变量
source /etc/profile
10.初始化数据库用户表
# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.22-MariaDB Source distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> delete from user where host='localhost.localdomain' or host='127.0.0.1' or host='::1' or user='';
Query OK, 5 rows affected (0.00 sec)