MySQL安裝版本為8.0
https://www.mysql.com/
MySQL Community Downloads
https://dev.mysql.com/downloads/
Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package
https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
安裝環(huán)境為CentOS7
[root@localhost vagrant]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[root@localhost vagrant]# uname -a
Linux localhost.localdomain 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
使用wget下載并安裝MySQL官方的 Yum Repository
[root@localhost vagrant]# mkdir mysql
[root@localhost vagrant]# cd mysql/
[root@localhost mysql]# yum install wget -y //安裝wget
...
[root@localhost mysql]# wget -i -c https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
...
[root@localhost mysql]# ls
mysql80-community-release-el7-3.noarch.rpm
[root@localhost mysql]# rpm -i mysql80-community-release-el7-3.noarch.rpm
warning: mysql80-community-release-el7-3.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
安裝MySQL80
[root@localhost mysql]# yum search mysql-community-server
mysql-community-server.x86_64 : A very fast and reliable SQL database server
[root@localhost mysql]# yum install mysql-community-server.x86_64 //等待MySQL安裝完成
初始化MySQL80
//mysql80在完成初始化之后無(wú)法修改大小寫(xiě)忽略的配置 只能在初始化之前設(shè)置
//第一種方式
[root@localhost mysql]# /usr/sbin/mysqld --initialize --user=mysql --lower-case-table-names=1
//第二種方式 推薦 使用vim修改、etc/my.cnf文件 lower-case-table-names=1
[root@localhost mysql]# yum install vim -y
[root@localhost mysql]# vim /etc/my.cnf //添加lower-case-table-names=1
啟動(dòng)MySQL80
[root@localhost mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
//如果mysql啟動(dòng)失敗, 可以刪除/var/lib/mysql文件夾重新啟動(dòng)
[root@localhost mysql]# systemctl start mysqld
[root@localhost mysql]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-01-12 16:00:41 UTC; 9s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 2135 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 2207 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─2207 /usr/sbin/mysqld
查看MySQL80中Root角色初始密碼
[root@localhost mysql]# cat /var/log/mysqld.log | grep password
連接到MySQL80
[root@localhost mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.22
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
最后編輯于 :2021.01.29 17:32:37
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者 【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。 平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。