出于学习mysql,需要进行各种实验,有时需要新的数据库,这时就需要进行初始化,进而得到一个类似于新装的环境。
- 首先查看mysql是否启动,若启动则将其关闭
[root@fei-7 ~]# systemctl status mysql
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: active (running) since Fri 2020-07-17 21:51:50 CST; 1 day 12h ago
Docs: man:systemd-sysv-generator(8)
Process: 17093 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)
Process: 17126 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysqld.service
├─17139 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/dat...
└─17621 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr...
Jul