旗下导航:搜·么
当前位置:网站首页 > MySQL教程 > 正文

Centos7.3装置mysql5.7.18 rpm教程【MySQL教程】,mysql5.7.18,Centos7.3,教程

作者:搜教程发布时间:2019-12-01分类:MySQL教程浏览:87评论:0


导读:本文重要引见了阿里云Centos7.3装置mysql5.7.18rpm装置教程,须要的朋侪能够参考下,希望能协助到人人。卸载MariaDBCentOS7默许装置Ma...
本文重要引见了阿里云 Centos7.3装置mysql5.7.18 rpm装置教程,须要的朋侪能够参考下,希望能协助到人人。

卸载MariaDB

CentOS7默许装置MariaDB而不是MySQL,而且yum效劳器上也移除了MySQL相干的软件包。由于MariaDB和MySQL可能会争执,故先卸载MariaDB。

1、装置新版mysql之前,我们须要将体系自带的mariadb-lib卸载

[root@iZwz94qazh62gk5ewl4ei2Z home]# rpm -qa | grep -i mariadb
mariadb-libs-5.5.52-1.el7.x86_64
[root@iZwz94qazh62gk5ewl4ei2Z home]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

2、到mysql的官网下载最新版mysql的rpm鸠合包:mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar

3、上传mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar到linux效劳器,并解压tar包

[root@iZwz94qazh62gk5ewl4ei2Z home]# mkdir mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# tar -xf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar -C mysql
[root@iZwz94qazh62gk5ewl4ei2Z home]# cd mysql
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# ll
total 459492
-rw-r--r-- 1 7155 31415 23618836 Mar 20 17:40 mysql-community-client-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  335496 Mar 20 17:40 mysql-community-common-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  3747352 Mar 20 17:40 mysql-community-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 39086508 Mar 20 17:40 mysql-community-embedded-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 135869292 Mar 20 17:40 mysql-community-embedded-devel-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  2177064 Mar 20 17:40 mysql-community-libs-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415  1723180 Mar 20 17:40 mysql-community-libs-compat-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 159060212 Mar 20 17:41 mysql-community-server-5.7.18-1.el6.x86_64.rpm
-rw-r--r-- 1 7155 31415 104881084 Mar 20 17:41 mysql-community-test-5.7.18-1.el6.x86_64.rpm

4、运用rpm -ivh敕令举行装置

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-common-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-common-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-libs-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-libs-5.7.18-1.el6################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-client-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]# rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm
warning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...             ################################# [100%]
Updating / installing...
  1:mysql-community-server-5.7.18-1.e################################# [100%]
[root@iZwz94qazh62gk5ewl4ei2Z mysql]#

上面几个包有依靠关联,实行有前后。

运用rpm装置体式格局装置mysql,装置的途径以下:

a 数据库目次
/var/lib/mysql/
b 设置文件
/usr/share/mysql(mysql.server敕令及设置文件)
c 相干敕令
/usr/bin(mysqladmin mysqldump等敕令)
d 启动剧本
/etc/rc.d/init.d/(启动剧本文件mysql的目次)
e /etc/my.conf

5、 数据库初始化

为了保证数据库目次为与文件的所有者为 mysql 上岸用户,假如你的linux体系是以 root 身份运转 mysql 效劳,须要实行下面的敕令初始化

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysqld --initialize --user=mysql

假如是以 mysql 身份登录运转,则能够去掉 --user 选项。

别的 --initialize 选项默许以“平安”形式来初始化,则会为 root 用户生成一个暗码并将该暗码标记为逾期,上岸后你须要设置一个新的暗码,

而运用 --initialize-insecure 敕令则不运用平安形式,则不会为 root 用户生成一个暗码。

这里演示运用的 --initialize 初始化的,会生成一个 root 账户暗码,暗码在log文件里,赤色地区的就是自动生成的暗码

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# cat /var/log/mysqld.log
2017-06-05T14:30:52.709474Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-05T14:30:55.590590Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-05T14:30:56.000269Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-05T14:30:56.109868Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 960c533e-49fb-11e7-91f2-00163e089fd2.
2017-06-05T14:30:56.116186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-05T14:30:56.116777Z 1 [Note] A temporary password is generated for root@localhost: :Wu?2QQutQwj

如今启动mysql数据库systemctl start mysqld.service(Centos7特有的启动体式格局)

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# systemctl start mysqld.service

能够运用下面两个敕令对mysql举行住手,启动和重启:

启动:

运用 service 启动:service mysqld start
运用 mysqld 剧本启动:/etc/inint.d/mysqld start
运用 safe_mysqld 启动:safe_mysqld&

住手:

运用 service 启动:service mysqld stop
运用 mysqld 剧本启动:/etc/inint.d/mysqld stop
mysqladmin shutdown

重启:

运用 service 启动:service mysqld restart
运用 mysqld 剧本启动:/etc/inint.d/mysqld restart

衔接数据库

[root@iZwz94qazh62gk5ewl4ei2Z mysql]# mysql -u root -p
Enter password:

暗码输入: :Wu?2QQutQwj

修正暗码:

set password = password('你的暗码');
设置长途接见

grant all privileges on *.* to 'root' @'%' identified by '123456'; 
flush privileges;

设置mysql开机启动

加入到体系效劳:

chkconfig --add mysql

自动启动:

chkconfig mysql on

查询列表:

chkconfig

申明:都没封闭(off)时是没有自动启动。

相干引荐:

MySQL5.7.18怎样修正暗码

关于MySQL5.7.18主从复制搭建一主一从实例详解

分享mysql5.7.18在centos6.4下的装置设置教程(图文)

以上就是Centos7.3装置mysql5.7.18 rpm教程的细致内容,更多请关注ki4网别的相干文章!

标签:mysql5.7.18Centos7.3教程


欢迎 发表评论: