腾讯云CentOS 7.5安装MySQL

dbq我刚刚装好MySQL就不放图啦 1.下载安装包 wget http://dev.mysql.com/get/mysql57-community-release-el6-10.noarch.rpm 2.安装下载下来的rpm包 yum localinstall mysql57-community-release-el6-10.noarch.rpm 3.(可选)查看可用的安装包 yum repolist enabled|grep mysql 4.若之前在服务器已经装过了nginx可跳过,否则请安装 yum install gcc-c++ 5.安装mysql yum install -y mysql-community-server (此时会报错,解决办法是通过WinSCP(下载地址:click here)修改/etc/yum.repos.d/mysql-community.repo 源文件如下:
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
修改后保存再次执行 yum install -y mysql-community-server 6.启动mysql /bin/systemctl start mysqld.service 7.修改密码 通过WinSCP找到etc目录下的my.cnf文件,直接在[mysqld]下添加"skip-grant-tables"(双引号不用加,作用是登录时跳过登录认证,空也可登录)保存 # mysql -uroot -p 进入mysql密码为任意数

mysql>use mysql;
mysql>update user set authentication_string=password(“newpassword“) where user=”root”;
mysql>flush privileges;

修改完退出 mysql>quit 删除之前在my.cnf文件中添加的"skip-grant-tables" 8.重启mysql /bin/systemctl restart mysqld.service 9. 进入mysql mysql -uroot -p
上一篇:centos7 + mysql5.7 tar包解压安装


下一篇:libssl.so.10: cannot open shared object file: No such file or directory