linux MySQL Community Server 5.7.20 rpm 安装

匿名 (未验证) 提交于 2019-12-02 22:06:11

1. 下载rpm

https://downloads.mysql.com/archives/community/

linux

Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit), RPM BundleSep 14, 2017565.8M
(mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar)

2. 上传到服务器,解压

mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

3. 清除linux 自带的的包


root@xiaoluo ~]# rpm -qa | grep mysql  // 这个命令就会查看该操作系统上是否已经安装了mysql数据库
有的话,我们就通过 rpm -e 命令 或者 rpm -e --nodeps 命令来卸载掉

[root@xiaoluo ~]# rpm -e mysql  // 普通删除模式

[root@xiaoluo ~]# rpm -e --nodeps mysql  // 强力删除模式,如果使用上面命令删除时,提示有依赖的其它文件,则用该命令可以对其进行强力删除

4. 开始安装:顺序

common>libs>client>server>devel


mysql Access denied for user root@localhost错误解决方法总结

处理方法:

vi my.conf

skip-grant-tables

保存

service mysqld restart

2> 登录mysql

mysql 直接回车,就可以进入

mysql>

mysql>use mysql;

mysql>update user set authentication_string=password("your_new_password") where user="root";
mysql> flush privileges;

mysql>exit

3> 重启

 再次编辑/etc/my.cnf,把skip-grant-tables注释掉,不注释掉那就永远不需要密码就可以登录了,这就太可怕了。
 重启

4> 重新登录

[root@iZ25fftuiaeZ etc]# mysql -uroot -pyour_new_password

flush privileges;

我设置密码:123456 提示,其实改个复制一点的密码就可以。具体原因:

http://www.cnblogs.com/ivictor/p/5142809.html

如果只是修改为一个简单的密码,会报以下错误:

mysql>  ALTER USER USER() IDENTIFIED BY '12345678'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

这个其实与validate_password_policy的值有关。

validate_password_policy有以下取值:

PolicyTests Performed
0LOWLength
1MEDIUMLength; numeric, lowercase/uppercase, and special characters
2STRONGLength; numeric, lowercase/uppercase, and special characters; dictionary file

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。

有时候,只是为了自己测试,不想密码设置得那么复杂,譬如说,我只想设置root的密码为123456。

必须修改两个全局参数:

首先,修改validate_password_policy参数的值

mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec)

这样,判断密码的标准就基于密码的长度了。这个由validate_password_length参数来决定。

mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ |                          8 | +----------------------------+ 1 row in set (0.00 sec)

validate_password_length参数默认为8,它有最小值的限制,最小值为:

validate_password_number_count + validate_password_special_char_count + (2 * validate_password_mixed_case_count)

其中,validate_password_number_count指定了密码中数据的长度,validate_password_special_char_count指定了密码中特殊字符的长度,validate_password_mixed_case_count指定了密码中大小字母的长度。

这些参数,默认值均为1,所以validate_password_length最小值为4,如果你显性指定validate_password_length的值小于4,尽管不会报错,但validate_password_length的值将设为4。如下所示:

mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ |                          8 | +----------------------------+ 1 row in set (0.00 sec)  mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec)  mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ |                          4 | +----------------------------+ 1 row in set (0.00 sec)

如果修改了validate_password_number_count,validate_password_special_char_count,validate_password_mixed_case_count中任何一个值,则validate_password_length将进行动态修改。

mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ |                          4 | +----------------------------+ 1 row in set (0.00 sec)  mysql> select @@validate_password_mixed_case_count; +--------------------------------------+ | @@validate_password_mixed_case_count | +--------------------------------------+ |                                    1 | +--------------------------------------+ 1 row in set (0.00 sec)  mysql> set global validate_password_mixed_case_count=2; Query OK, 0 rows affected (0.00 sec)  mysql> select @@validate_password_mixed_case_count; +--------------------------------------+ | @@validate_password_mixed_case_count | +--------------------------------------+ |                                    2 | +--------------------------------------+ 1 row in set (0.00 sec)  mysql> select @@validate_password_length; +----------------------------+ | @@validate_password_length | +----------------------------+ |                          6 | +----------------------------+ 1 row in set (0.00 sec)

然,前提是validate_password插件必须已经安装,MySQL5.7是默认安装的。

那么如何验证validate_password插件是否安装呢?可通过查看以下参数,如果没有安装,则输出将为空。

mysql> SHOW VARIABLES LIKE 'validate_password%'; +--------------------------------------+-------+ | Variable_name                        | Value | +--------------------------------------+-------+ | validate_password_dictionary_file    |       | | validate_password_length             | 6     | | validate_password_mixed_case_count   | 2     | | validate_password_number_count       | 1     | | validate_password_policy             | LOW   | | validate_password_special_char_count | 1     | +--------------------------------------+-------+ 6 rows in set (0.00 sec)


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!