您好,登录后才能下订单哦!
本篇文章为大家展示了服务器Centos 7中怎么安装mysql8.0.16,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
1. Select Operating System: 选择 Red Hat ,CentOS 是基于红帽的,Select OS Version: 选择 linux 7
2. 选择 RPM Bundle 点击 Download
tar -xvf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar
mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar解压后有如下8个文件:
-rw-r--r-- 1 7155 31415 33432660 May 3 12:38 mysql-community-client-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 588520 May 3 12:38 mysql-community-common-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 5712552 May 3 12:38 mysql-community-devel-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 24493344 May 3 12:38 mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 3127296 May 3 12:38 mysql-community-libs-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 2177156 May 3 12:38 mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 422672748 May 3 12:39 mysql-community-server-8.0.16-2.el7.x86_64.rpm -rw-r--r-- 1 7155 31415 114848996 May 3 12:40 mysql-community-test-8.0.16-2.el7.x86_64.rpm
建议装之前先把之前的mysql相关包全部卸载,rpm -e --nodeps <包名>即可
按如下顺序依次安装:
rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.16-2.el7################################# [100%]
rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-8.0.16-2.el7################################# [100%]
rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-compat-8.0.1################################# [100%]
rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-client-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-8.0.16-2.e################################# [100%]
rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-server-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-8.0.16-2.e################################# [100%]
yum install -y openssl-devel.x86_64 openssl.x86_64
Installed:
openssl-devel.x86_64 1:1.0.2k-16.el7_6.1
Dependency Installed:
keyutils-libs-devel.x86_64 0:1.5.8-3.el7 krb5-devel.x86_64 0:1.15.1-37.el7_6 libcom_err-devel.x86_64 0:1.42.9-13.el7 libkadm5.x86_64 0:1.15.1-37.el7_6 libselinux-devel.x86_64 0:2.5-14.1.el7
libsepol-devel.x86_64 0:2.5-10.el7
rpm -ivh mysql-community-devel-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-devel-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-devel-8.0.16-2.el################################# [100%]
yum install -y perl.x86_64 perl-devel.x86_64
Installed:
perl-devel.x86_64 4:5.16.3-294.el7_6
Dependency Installed:
gdbm-devel.x86_64 0:1.10-8.el7 libdb-devel.x86_64 0:5.3.21-24.el7 perl-ExtUtils-Install.noarch 0:1.58-294.el7_6 perl-ExtUtils-MakeMaker.noarch 0:6.68-3.el7
perl-ExtUtils-Manifest.noarch 0:1.61-244.el7 perl-ExtUtils-ParseXS.noarch 1:3.18-3.el7 perl-Test-Harness.noarch 0:3.28-3.el7 pyparsing.noarch 0:1.5.6-9.el7
systemtap-sdt-devel.x86_64 0:3.3-3.el7
Complete!
yum install -y perl-JSON.noarch
Installed:
perl-JSON.noarch 0:2.59-2.el7
Complete!
yum -y install autoconf
Installed:
autoconf.noarch 0:2.69-11.el7
Dependency Installed:
perl-Data-Dumper.x86_64 0:2.145-3.el7
Complete!
rpm -ivh mysql-community-test-8.0.16-2.el7.x86_64.rpm
warning: mysql-community-test-8.0.16-2.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-test-8.0.16-2.el7################################# [100%]
mysql -V
显示如下信息说明安装成功
mysql Ver 8.0.16 for Linux on x86_64 (MySQL Community Server - GPL)
ll /etc/my.cnf
-rw-r--r-- 1 root root 1243 May 3 05:11 /etc/my.cnf
vim /etc/my.cnf
添加如下信息:
#配置MYSQL大小写敏感(1-不敏感,0-敏感) lower_case_table_names=1
注意!MySQL8.0想要 大小写不敏感,必须在安装好MySQL后未启动之前 修改MySQL配置文件设置为不敏感,一旦启动后,再设置是无效的,而且启动会报错。
如果已经晚了,那必须把MySQL数据库文件全部 删除,修改配置文件再启动。
如果数据不重要,可以先关闭服务删掉数据,再执行以上操作:
service mysqld stop rm -rf /var/lib/mysql
mysqld --initialize --console
chown -R mysql:mysql /var/lib/mysql/
systemctl start mysqld
备注:
停止命令:service mysqld stop
service mysqld status
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2019-07-15 20:24:51 CST; 1min 18s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 13374 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 13397 (mysqld)
Status: "SERVER_OPERATING"
CGroup: /system.slice/mysqld.service
└─13397 /usr/sbin/mysqld
Jul 15 20:24:49 iZbp109fnkszgzwbnmaoe1Z systemd[1]: Starting MySQL Server...
Jul 15 20:24:51 iZbp109fnkszgzwbnmaoe1Z systemd[1]: Started MySQL Server.
cat /var/log/mysqld.log
2019-07-15T12:23:06.493163Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.16) initializing of server in progress as process 13286
2019-07-15T12:23:10.070584Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: dK3rw_EM_mjs
2019-07-15T12:23:11.237915Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.16) initializing of server has completed
2019-07-15T12:24:05.782446Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 13361
2019-07-15T12:24:05.793657Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-07-15T12:24:05.793678Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2019-07-15T12:24:05.793704Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2019-07-15T12:24:05.793814Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-07-15T12:24:05.793897Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-07-15T12:24:05.794672Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
2019-07-15T12:24:50.367615Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 13397
2019-07-15T12:24:50.979080Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-07-15T12:24:51.199081Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.16' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2019-07-15T12:24:51.265716Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
mysql -u root -p
+ 回车键
输入临时密码(输入时不会显示出来,输入完直接回车)
alter USER 'root'@'localhost' IDENTIFIED BY '密码';
密码:必须包含数字及大小写字母特殊字符
依次执行下列mysql命令 授权远程连接
查看所有用户是否可以远程连接,依次执行下列命令:
show databases;
use mysql;
select host, user, authentication_string, plugin from user;
修改root用户host值,使root用户可以远程登录
update user set host = "%" where user='root';
刷新
flush privileges;
上述内容就是服务器Centos 7中怎么安装mysql8.0.16,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。