本人服务器啥也没有.直接安装,但是还是遇到些问题,记录一下.
1.下载并安装MySQL官方的 Yum Repository
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
什么鬼:
-bash: wget: command not found
明明已经安装了wget,centos本身也自带了wget啊,无语,鄙人学浅不知什么原因,卸载重装wget,就这样好了.
使用上面的命令就直接下载了安装用的Yum Repository,大概25KB的样子,然后就可以直接yum安装了。
yum -y install mysql57-community-release-el7-10.noarch.rpm
装MySQL服务器
yum -y install mysql-community-server
2 MySQL数据库设置
1.启动MySQL
systemctl start mysqld.service
查看MySQL运行状态
systemctl status mysqld.service

此时MySQL已经开始正常运行,不过要想进入MySQL还得先找出此时root用户的密码,通过如下命令可以在日志文件中找出密码:
grep "password" /var/log/mysqld.log

如下命令进入数据库:
mysql -uroot -p
输入初始密码,此时不能做任何事情,因为MySQL默认必须修改密码之后才能操作数据库,*注意密码规则:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
密码问题可参考: https://blog.csdn.net/hello_world_qwp/article/details/79551789
因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉:
yum -y remove mysql57-community-release-el7-10.noarch
网友评论