1. 安装包下载
首先进去官网安装包下载页面,选择bundle.tar结尾的文件下载。
2. 安装
执行 yum install mysql-community-{server,client,common,libs}-*
3. 启动
执行 service mysqld start
4. 登录并修改密码
执行 grep 'temporary password' /var/log/mysqld.log
找到root账户的默认密码。
执行 mysql -uroot -p
然后输入上一步查询到的密码。
执行 ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass2!';
修改root账户密码。
5. 创建用户和授权
root账户默认只能在本地使用,因此需要通过以下命令创建一个可以在其他网络位置使用的root账户:create user 'root'@'%' identified by 'MyNewPass@2!';grant all on *.* to 'root'@'%' with grant option;FLUSH PRIVILEGES