赞
踩
地址:https://www.mysql.com/downloads/
下载内容包括如图所示:
开始安装首先要清理环境
清理环境
centos7会自带一个mariadb
查看是否已安装
rpm -qa |grep -i mysql
rpm -qa |grep -i mariadb(centos7默认系统自带的)
mariadb是从mysql来的,是它的一个分支,需要清理掉
清理掉mariadb包
用yum直接安装你的话,用的mariadb的yum源,它跟mysql官方正式版不太一样,我们要安装官方正式版,就需要清掉mariadb,然后手动安装自己下载的官方正式版mysql
rpm -e 加上包名,把mariadb包清掉
可以看到用rpm删除会失败,提示有依赖关系的软件需要安装
rpm -e mariadb-libs-5.5.56-2.el7.x86_64
rpm删除时如果有依赖关系,可以用yum remove + 包名来删除mariadb
开始安装mysql服务:
一般用装软件用yum直接安装也可以,但是有一个问题:用yum的话,是到默认的mariadb用的yum源去找,可能会找不到,所以我们自己来安装
rpm –ivh + 包安装所需要的包
rpm -ivh MySQL-client-5.6.42-1.el7.x86_64.rpm
rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
server安装成功后会输出一些信息,如下:
[root@localhost soft]# rpm -ivh MySQL-server-5.6.42-1.el7.x86_64.rpm
warning: MySQL-server-5.6.42-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
安装成功后,修改 /etc/my.cnf 文件
lower-case-table-names=1
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
transaction_isolation = READ-COMMITTED
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
max_connections=2000
log-bin=mysql-bin
relay-log=mysql-relay-bin
server-id=109
default_authentication_plugin=mysql_native_password
tmp_table_size = 256M
max_heap_table_size = 256M
log-bin-trust-function-creators=1
innodb_log_file_size = 500M
innodb_log_buffer_size = 800M
innodb_strict_mode = 0
#skip-grant-tables
然后再登录,修改密码
update user set host ='localhost' where user ='root';
alter user 'root'@'%' identified with mysql_native_password by 'Hadoop3!';
grant all privileges on *.* to 'root'@'localhost';
mysql> show variables like 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
7 rows in set (0.00 sec)
1.
启动防火墙 systemctl start firewalld
2.
禁用防火墙 systemctl stop firewalld
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。