社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
-省却安装vmware虚拟机管理的部分
-centos7下载地址:
官方:https://www.centos.org/download/
镜像文件地址:http://mirrors.nju.edu.cn/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
-centos安装名称:MySQLAAS
-centos安装路径:D:vmMySQL
-Root/密码:******.
-安装centos的图形化界面(默认,安装完毕centos之后,首次登陆root是文本命令行界面)
《鸟哥的Linux私房菜-基础学习篇》:如何安装Linux的图形界面
最本质的问题在于Linux支持的登录方式有7种,tty1-tty7, tty7就是我们常用的图形化界面,tty1-tty6都是文字命令界面的变种。
打开tty1-tty6的方式是Ctrl+ALT +[F1-F6],tty7的打开方式,是在登录tty1-6之后,启动命令 startx, 如果 X Server 有配置好,那么就可以启动图形化界面。
如果没有按照好 X Server 当然是不能启动 X Window的,所以一开始安装 LInux的时候就要选好安装的组件,或者在之后通过YUM安装相关软件。
-MySQL服务专用账户 MySQLAdmin/******.
3.1 下载路径: 选择 MySQL Community 8.0 版本, 下载地址:
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17-1.el8.x86_64.rpm-bundle.tar
3.2 安装:
1)解压tar文件:tar -xf
2)按照以下顺序安装这些包:
mysql-community-server
mysql-community-client
mysql-community-libs
mysql-community-common
mysql-community-libs-compact
以上这些包是确保一个MySQL数据库服务正常运作的必要包。
>sudo yum install mysql-community-{server,client,common,libs}-*
3)配置
一般来说,直接运行上面的yum命令后,安装程序会在系统的各个主要目录下生成这些MySQL运行必须的文件:
Files or Resources |
Location |
Client programs and scripts |
/usr/bin |
mysqld server |
/usr/sbin |
Configuration file |
/etc/my.cnf |
Data directory |
/var/lib/mysql |
Error log file |
For RHEL, Oracle Linux, CentOS or Fedora platforms:/var/log/mysqld.log For SLES: /var/log/mysql/mysqld.log |
Value of secure_file_priv |
/var/lib/mysql-files |
System V init script |
For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld For SLES: /etc/init.d/mysql |
Systemd service |
For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld For SLES: mysql |
Pid file |
/var/run/mysql/mysqld.pid |
Socket |
/var/lib/mysql/mysql.sock |
Keyring directory |
/var/lib/mysql-keyring |
Unix manual pages |
/usr/share/man |
Include (header) files |
/usr/include/mysql |
Libraries |
/usr/lib/mysql |
Miscellaneous support files (for example, error messages, and character set files) |
/usr/share/mysql |
4)安装完毕之后的注意事项
-在安装完毕后,会在 centos 自动生成一个 mysql 的用户,一个 mysql的用户组。
-如果是MySQL8之前的版本,还可能生成一个 /usr/my.cnf文件,与 /etc/my.cnf是冲突的,因此需要把 /usr/my.cnf合并到 /etc/my.cnf里面,并且删除/usr/my.cnf
-默认安装完毕 MySQL,数据库服务并不会自动启动,我们必须手动开启服务
>systemctl start mysqld
-root用户密码是随机生成的,我们需要捕获这份密码,并修改成我们自己熟记的
[mysqladmin@SQLAAS Downloads]$ sudo grep 'temporary password' /var/log/mysqld.log
2019-09-01T15:35:49.811164Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: HJu2(khHtCG0
mysql> alter user 'root'@'localhost' identified by '1QAZ2WSX' ;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql>
mysql> alter user 'root'@'localhost' identified by 'LuckyNumber234.' ;
Query OK, 0 rows affected (0.01 sec)
-设置随机启动MySQL服务:
-添加一个 MySQL 用户,使其拥有创建数据库的权限
-MySQLAdmin/******
以下是犯的错误
>create user 'MySQLAdmin'@'localhost' identified by 'MySQLAdmin' ;
-配置远程登录允许:
>grants all on *.* 'root' ;
>ERROR 1410 (42000): You are not allowed to create a user with GRANT
加上 privileges 关键字:
> grant all privileges on *.* to 'root'@'%' ;
ERROR 1410 (42000): You are not allowed to create a user with GRANT
MySQL 8 中新建一个远程账户,必须从create user 开始:
mysql> create user 'MySQLAdmin'@'%' identified by '*******.' ;
Query OK, 0 rows affected (0.05 sec)
mysql> grant all on *.* to 'MySQLAdmin'@'%' ;
Query OK, 0 rows affected (0.05 sec)
mysql> flush privileges ;
Query OK, 0 rows affected (0.03 sec)
-依赖报错:
[mysqladmin@SQLAAS Downloads]$ rpm -i mysql-community-server-8.0.17-1.el8.x86_64.rpm
warning: mysql-community-server-8.0.17-1.el8.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
libc.so.6(GLIBC_2.28)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libcrypto.so.1.1()(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libssl.so.1.1()(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libssl.so.1.1(OPENSSL_1_1_0)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libssl.so.1.1(OPENSSL_1_1_1)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(CXXABI_1.3.11)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(CXXABI_1.3.8)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(CXXABI_1.3.9)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(GLIBCXX_3.4.20)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(GLIBCXX_3.4.21)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libstdc++.so.6(GLIBCXX_3.4.22)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libtirpc.so.3()(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
libtirpc.so.3(TIRPC_0.3.0)(64bit) is needed by mysql-community-server-8.0.17-1.el8.x86_64
mysql-community-client(x86-64) >= 8.0.11 is needed by mysql-community-server-8.0.17-1.el8.x86_64
mysql-community-common(x86-64) = 8.0.17-1.el8 is needed by mysql-community-server-8.0.17-1.el8.x86_64
mariadb-server is obsoleted by mysql-community-server-8.0.17-1.el8.x86_64
尝试1:调整安装顺序
- mysql-community-common-8.0.17-1.el8.x86_64.rpm
- mysql-community-debuginfo-8.0.17-1.el8.x86_64.rpm
尝试2:先升级YUM
>sudo yum update
>sudo yum install mysql-community-{server,client,common,libs}-*
以上尝试都失败!
尝试3:通过YUM安装
-下载YUM Repo地址:https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[mysqladmin@SQLAAS MySQL]$ sudo yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: ftp.sjtu.edu.cn
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:8.0.17-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.17-1.el7 for package: mysql-community-server-8.0.17-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.17-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:8.0.17-1.el7 will be installed
---> Package mysql-community-server.x86_64 0:8.0.17-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 8.0.17-1.el7 for package: mysql-community-server-8.0.17-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-community-server-8.0.17-1.el7.x86_64 (mysql80-community)
Requires: mysql-community-common(x86-64) = 8.0.17-1.el7
Installed: mysql-community-common-8.0.17-1.el8.x86_64 (installed)
mysql-community-common(x86-64) = 8.0.17-1.el8
Available: mysql-community-common-8.0.11-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.11-1.el7
Available: mysql-community-common-8.0.12-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.12-1.el7
Available: mysql-community-common-8.0.13-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.13-1.el7
Available: mysql-community-common-8.0.14-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.14-1.el7
Available: mysql-community-common-8.0.15-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.15-1.el7
Available: mysql-community-common-8.0.16-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.16-1.el7
Available: mysql-community-common-8.0.16-2.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.16-2.el7
Available: mysql-community-common-8.0.17-1.el7.x86_64 (mysql80-community)
mysql-community-common(x86-64) = 8.0.17-1.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
卸载掉:mysql-community-common-8.0.17-1.el8.x86_64
>sudo yum remove mysql-community-common-8.0.17-1.el8.x86_64
重新安装:mysql-community-common-8.0.17-1.el7.x86_64
>sudo yum install mysql-community-common-8.0.17-1.el7.x86_64
可以解决,但安装时间过长,需要15个小时的时间,全部花在了下载耗时上面。
有没有办法通过直接安装下载好的rpm来完成?有!
实际上,第一次下载的MySQL安装包
(https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17-1.el8.x86_64.rpm-bundle.tar),
是 RH Linux 8/Centos8版本,而我虚拟装的是Centos7,因此必须下载 RH Linux 7 的安装包,如下:
https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar
再次安装:
-下载地址:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar
-解压及安装:
>tar -xf mysql-8.0.17-1.el7.x86_64.rpm-bundle.tar
>sudo yum install mysql-community-{client,common,devel,embedded,libs,server}-*
-安装错误:
Error: Package: akonadi-mysql-1.9.2-4.el7.x86_64 (@anaconda)
Requires: mariadb-server
Removing: 1:mariadb-server-5.5.60-1.el7_5.x86_64 (@anaconda)
mariadb-server = 1:5.5.60-1.el7_5
Obsoleted By: mysql-community-server-8.0.17-1.el7.x86_64 (/mysql-community-server-8.0.17-1.el7.x86_64)
Not found
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决方法:
-移除mariadb
-> sudo yum remove mariadb
->sudo yum install mysql-community-{client,common,devel,embedded,libs,server}-*
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!