//查看状态 systemctl status mysqld //停止服务 service mysqld stop //初始化数据库 mysqld --initialize --console //目录授权 chown -R mysql:mysql /var/lib/mysql/ //启动服务 systemctl start mysqld systemctl status mysqld
6、数据库操作
1 2 3 4 5 6 7 8 9 10 11 12 13
//查看临时密码 cat /var/log/mysqld.log //使用临时密码登录,录入命令后按回车键,然后录入临时密码 mysql -u root -p //修改MySQL数据库root用户密码 alter USER 'root'@'localhost' IDENTIFIED BY 'nitdDHpassword6***'; //授权远程登录 show databases; use mysql; select host, user, authentication_string, plugin from user; update user set host = "%" where user='root'; select host, user, authentication_string, plugin from user; flush privileges;