修改mysql密码
这个命令是对的。不过有要求。下面有改要求的办法。或者可以根据ta要求的设定密码
ALTER USER ‘root‘@‘172.16.5.125‘ IDENTIFIED BY ‘123456‘;
[Err] 1819 - Your password does not satisfy the current policy requirements
--解决方法:
查看 mysql 初始的密码策略(mysql5.7自带的)
SHOW VARIABLES LIKE ‘validate_password%‘;
关于 mysql 密码策略相关参数;
1)、validate_password_length 固定密码的总长度;
2)、validate_password_dictionary_file 指定密码验证的文件路径;
3)、validate_password_mixed_case_count 整个密码中至少要包含大/小写字母的总个数;
4)、validate_password_number_count 整个密码中至少要包含阿拉伯数字的个数;
5)、validate_password_policy 指定密码的强度验证等级,默认为 MEDIUM;
?
关于 validate_password_policy 的取值:
0/LOW:只验证长度;
1/MEDIUM:验证长度、数字、大小写、特殊字符;
2/STRONG:验证长度、数字、大小写、特殊字符、字典文件;
6)、validate_password_special_char_count 整个密码中至少要包含特殊字符的个数;
?
原文链接:https://blog.csdn.net/hello_world_qwp/article/details/79551789
如何设置简单的密码
2、首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,
输入设值语句 “ set global validate_password_policy=LOW; ” 进行设值,
?
3、当前密码长度为 8 ,如果不介意的话就不用修改了,按照通用的来讲,设置为 6 位的密码,设置 validate_password_length 的全局参数为 6 即可,
输入设值语句 “ set global validate_password_length=6; ” 进行设值,
4、现在可以为 mysql 设置简单密码了,只要满足六位的长度即可,
输入修改语句 “ ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘123456‘; ” 可以看到修改成功,表示密码策略修改成功了!!!
执行这个命令时报错。
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘_12345Qa‘;
error:[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ‘ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
https://blog.csdn.net/jgj0129/article/details/53420574
??好像是navcat的错误。
ALTER USER ‘root‘@‘172.16.5.125‘ IDENTIFIED BY ‘_12345Qa‘;
[Err] 1396 - Operation ALTER USER failed for ‘root‘@‘172.16.5.125‘
set global validate_password_policy=LOW;
[Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column ‘information_schema.PROFILING.SEQ‘ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
LINUX重启MYSQL的命令
systemctl restart mysqld.service
同事说改完要刷新的命令
FLUSH PRIVILEGES
mysql -uroot -p1qaz@WSX
error:-bash: !qaz2WSX: event not found
原因为您所输入的命令中间包含 !,叹号,不能组成命令。
应该将 !转义。
mysql修改密码
格式:mysql> set password for 用户名@localhost = password(‘新密码‘);
set password for root@localhost = password(‘1qaz@WSX‘);
抄自:https://www.cnblogs.com/mrhonest/p/10881646.html
mysql拒绝访问就要想到授权的问题
因为没有授权,所以拒绝访问
为什么访问的172.16.5.125--->172.31.8.35error
授权本地
grant all privileges on *.* to ‘root‘@‘localhost‘ identified by ‘1qaz@WSX‘;
授权所有所有ip访问 ‘%’
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘1qaz@WSX‘;
grant all privileges on *.* to ‘ly‘@‘%‘ identified by ‘1qaz@WSX‘;
为什么会有密码不符合的情况?
navicat连接了数据库(连接名是随便起的)。
显示的是所有的,还以为是只一个database呢。应该是所有的。
navicat和我就很迷
之前在navicat里设置的这两项。。。
set global validate_password_policy=LOW; set global validate_password_length=6;
怎么在mysql中查了下,又这样了。我吃
在改下密码吧:grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘;
set global validate_password_policy=MEDIUM; set global validate_password_length=8;
算了,不改了,就复杂的密码吧。
我的linux系统里查看mysql密码的命令
select *from mysql.user; 这些列里也没有密码password阿
| Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | password_last_changed | password_lifetime | account_locked |
https://blog.csdn.net/qq_40662239/article/details/90521588为什么这人的有。。。
抄袭博客。。。
Navicat for Mysql修改MySQL数据库密码,图文详解
https://www.cnblogs.com/zui-ai-java/p/10411000.html
MySQL修改密码
https://www.cnblogs.com/mrhonest/p/10881646.html
mysql授权IP登录
https://www.cnblogs.com/shihx/p/12046563.html
Linux中安装mysql、查看修改mysql原始密码、mysql数据导入、检查是否安装了mysql、如何启动mysql服务
https://www.csdn.net/gather_2f/MtTaIgzsNTY3NS1ibG9n.html
如何给mysql的普通用户赋予权限
https://blog.csdn.net/qq_36470898/article/details/100189795
MySQL 查看用户授予的权限???
https://www.cnblogs.com/kerrycode/p/7423850.html
MySql授权和撤销权限操作???
https://www.cnblogs.com/qlqwjy/p/8022575.html
【当你用心写完每一篇博客之后,你会发现它比你用代码实现功能更有成就感!】
mysql创建普通用户
create user ly identified by ‘ly123‘;
给予用户数据库的所有权限
grant all on shanghui.* to ‘shanghui‘@‘%‘;
刷新数据库
flush privileges;
mysql普通用户如果要登录,可以在mysqlroot里给授权
授予权限要在root用户里授予
grant 权限 on *.* to ‘用户‘@‘ip‘; 比如所有库的查询权限,就: *.* 代表所有库下的所有表 grant select on *.* to ‘用户‘@‘ip‘; 所有权限的话 grant all privileges on *.* to ‘用户‘@‘ip‘; 赋权限后记得刷新: flush privileges;
%代表所有ip
授权本机 grant all privileges on *.* to ‘ly‘@‘localhost‘ identified by ‘ly123‘; 授权其他 grant all privileges on *.* to ‘ly‘@‘%‘ identified by ‘ly123‘;
grant all privileges on *.* to ‘ly‘@‘localhost‘ identified by ‘1qaz@WSX‘; grant all privileges on *.* to ‘ly‘@‘%‘ identified by ‘1qaz@WSX‘;
设置查看的权限
SELECT、 INSERT、 UPDATE、 DELETE(其他的)
grant select,insert on *.* to ‘ly‘@‘%‘ identified by ‘1qaz@WSX‘; grant select,insert on *.* to ‘ly‘@‘localhost‘ identified by ‘1qaz@WSX‘; flush privileges;
授权。不要忘记了本机‘localhost‘
或者其他机器‘%‘
授权
就可以登了。。。
查看普通用户授予的授权
show grants for 用户名; show grants for ly;
授予all privileges 或者select 权限的问题
明明给了select 权限,但是确是all privileges权限的问题。
精致boy说: 权限改动以后都会记录 之前的要手动删除
我就去搜了撤销的命令。
撤销已经赋予mysql用户权限的权限
revoke 跟 grant 的语法差不多,只需要把关键字 “to” 换成 “from” 即可:
revoke all on *.* from dba@localhost;
grant all privileges on *.* to ‘ly‘@‘%‘ identified by ‘1qaz@WSX‘;
revoke all privileges on *.* from ‘ly‘@‘%‘ identified by ‘1qaz@WSX‘;
上面的语句会报错:(不知道什么原因阿)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘identified by ‘1qaz@WSX‘‘ at line 1;
因为看到这个想起相反的命令(如下)。(试了下果然可以)
revoke ALL PRIVILEGES on *.* from ‘ly‘@‘%‘ ;
如果先设置了ALL PRIVILEGES权限,就要先移除了这个权限,才可以设置其他的小权限(select, insert....)
ps:USAGE :“无权限”
如果先设置了设置其他的小权限(select, insert....),不需要先移除了这个权限,可直接设置ALL PRIVILEGES权限
mysql 授予用户只对一个库的权限
grant select, insert, update, delete on xj4k.* to ly@localhost ;
这个因为是local的所以不起作用吧。应该是@‘%’才对吧。
设置对一个库的增删改的命令。
grant select, insert, update, delete on xj4k.* ;
为什么权限有两行呢?
这样就可以只对xj4k有权限,对其他的数据库没有
这么多数据库呢??
抄自:
MySQL 数据库赋予用户权限操作表
https://www.cnblogs.com/goodhacker/p/3373213.html
MySQL设置某一用户只对一个数据库拥有所有权限
https://blog.csdn.net/weixin_43739146/article/details/102789473
大数据平台上的可以只操作一个我需要的数据库的表了,清爽。
看root用户有所有表的权限那么多表,看不过来。
真好。
GRANT SELECT, INSERT, UPDATE, DELETE ON `xj4k`.* TO ‘ly‘@‘%‘
撤销权限(复制上面改revoke和from)
revoke SELECT, INSERT, UPDATE, DELETE ON `xj4k`.* from ‘ly‘@‘%‘
没了
用上面那个长的:
grant select, insert, update, delete on xj4k.* to ly @ ‘%‘ ;