MySQL安装客户端
yum install mysql
MySQL安装服务端
yum install mysql-server yum install mysql-devel
MySQL启动、停止、重启、查看状态、开机自启
systemctl start mysqld systemctl stop mysqld systemctl restart mysqld systemctl status mysqld systemctl enable --now mysqld
查看监听的端口
netstat -lnpt //PS:CentOS默认没有netstat命令,需要安装net-tools工具,yum install -y net-tools
打开MySQL命令行
mysql -uroot -p
修改MySQL密码
use mysql; //应用mysql数据库 update user set authentication_string='' where user='root'; //将字段置空 alter user 'root'@'localhost' identified by 'root'; //修改密码为root flush privileges; //将当前user和privilige表中的用户信息,权限设置从mysql库(MySQL数据库的内置库)中提取到内存里