关于MySQL的那些事
MySql 通过IP连接权限设置
mysql -u root -p use mysql; update user set host='%' where user='root'; flush privileges;
MySql 忘记密码,绕过密码
Mysql数据库初始化 mysql_secure_installation mysql数据库root用户密码忘记 1.修改 vim/etc/my.cnf -Windows在mysql根目录下的my.ini 在mysqld选项下添加skip-grant-tables 跳过密码认证 2.systemctl restart mariadb 重启服务 3.mysql_secure_installation 初始化数据库 3.mysql-uroot-p 任意密码 use mysql; update user set Password=password('密码')where User = '用户名' 更新指定用户名的密码 flush privileges 刷新权限表 mysql password函数 select password ('root') 密码解析 select sha1(unhex(sha1('root'))); sql注入漏洞查询数据库的数据,select*from mysql.user where User='root'; cmd5.com ->mysql5 -->root 连接mysql数据库 mysql -u用户名 -p密码 会留记录在history mysql -u用户名 -p (交互式密码) 不留记录在history
MySQL 常用指令
创建用户 CREATE USER 'ag'@'%' IDENTIFIED BY '123'; 给予权限 指定数据库给tes用户授权 grant all privileges on 想授权的数据库.* to 'test'@'%' with grant option; 给tset用户授予所有数据库权限 grant all privileges on . to 'test'@'%' with grant option; 如果权限要分的细一点all 换成 select,delete,update,create,drop,需要什么权限给什么权限 有些版本'%'不包括localhost,要单独对@'localhost'进行赋值 grant select,insert,update,delete on . to test@"localhost" Identified by "testpassword"; 刷新配置 flush privileges; 修改root密码 update mysql.user set authentication_string='新密码' where user='root';
本文作者:youget
本文链接:https://www.cnblogs.com/youget/p/17306654.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步