必赢手机app下载 / Blog / 必赢手机app下载 / CentOS6、7安装MySQL5.7全教程
图片 1

CentOS6、7安装MySQL5.7全教程

CentOS6、7安装MySQL5.7全教程

做开荒总得用到数码吧,Linux作为服务器,总得有二个数据库来存储测量检验用的数目,所以呢,这里附上CentOS6、7装置MySQL5.7的教程喔~

用到的工具:CentOs6、7;Mysql注重包

 

Step1.
查看已设置的mysql:

# yum list installed | grep mysql
mysql-libs.x86_64       5.1.71-1.el6    @anaconda-CentOS-201311272149.x86_64/6.5

卸载当前mysql:

# yum -y remove mysql-libs.x86_64

 

Step2. 下载安装所需信赖:

先到https://dev.mysql.com/downloads/repo/yum/下载,依照自身Linux版本来采用,举例自个儿是Centos6.5,故选用第贰个,依次类推:

图片 1

将下载的mysql80-community-release-el6-1.noarch.rpm文件上传到Linux服务器中

 

Step3. 设置信赖:

应用以下命令,注意此命令需求在mysql80-community-release-el6-1.noarch.rpm文书的四面八方目录下实践。

实践进度中会现身Is this ok [y/N]:
,输入y就行了。

# yum localinstall mysql80-community-release-el6-1.noarch.rpm

实施完事后,使用#
ls /etc/yum.repos.d命令能够见见多出来了四个公文

# ls /etc/yum.repos.d
mysql-community.repo        mysql-community-source.repo

 

 

Step4. 运营yum repolist
enabled | grep
mysql查看mysql57是否可用。

一旦运维的结果如下:

# yum repolist enabled | grep mysql
mysql-connectors-community           MySQL Connectors Community              59
mysql-tools-community                MySQL Tools Community                   65
mysql80-community                    MySQL 8.0 Community Server              29

则必要采纳命令vim
/etc/yum.repos.d/mysql-community.repo修改mysql57的enabled为1,而其余的版本则设为0.切实可行如下:

vim /etc/yum.repos.d/mysql-community.repo

修改部分:

......
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
 ......
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/6/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

设置完的运维结果为:

# yum repolist enabled | grep mysql
mysql-connectors-community           MySQL Connectors Community              59
mysql-tools-community                MySQL Tools Community                   65
mysql57-community                    MySQL 5.7 Community Server             273

 

 

Step5. 起初设置:

# yum install mysql-community-server

假若中途出错截至,通常是因为网速原因,能够再次实施此命令

 

Step6. 安装达成后,运行mysql服务(可能率先次会出错,那就再运维一遍~):

# service mysqld start
Initializing MySQL database:  [FAILED]
# service mysqld start
Starting mysqld:  [  OK  ]

 

 

Step7. 查看默许root客商的密码:

# cat /var/log/mysqld.log | grep root@localhost
2018-08-29T03:11:26.560863Z 1 [Note] A temporary password is generated for root@localhost: DJ#erA*-p6&?

DJ#erA*-p6&?   
即为root客户的领头密码

 

Step8. 使用mysql -uroot
-p命令登入,要求输入上一步中的密码。

跻身之后实行别的操作都会提醒EOdysseyROEscort 1820 (HY000): You must reset your password using
ALTERubicon USELX570 statement before executing this
statement.那时急需复位密码:

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password=password('new_password');
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> alter user 'root'@'localhost' password expire never;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

再脱离mysql,使用新密码重新登入就能够。

 

什么,是还是不是hin轻巧哩,有啥难题请留下你的评头品足喔~

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

相关文章

网站地图xml地图