MySQL database management

Source: Internet
Author: User

创建用户及密码mysql> create user ‘zhao‘@‘loacl‘ identified by ‘123123‘;mysql> use mysql;

创建密文密码mysql> select password(‘123123‘);  #查看明文对应的密文

mysql> create user ‘test01‘@‘localhost‘ identified by   #创建密文密码 ‘E56A114692FE0DE073F9A1DD68A00EEB9703F3F1‘;删除用户mysql> drop user ‘test01‘@‘localhost‘;

修改已存在用户的密码set password =pssword(‘123123‘);修改其他用户密码set password for ‘user02‘@‘localhost‘ = password(‘123abc‘);重命名用户mysql> rename user ‘zz‘@‘host‘ to ‘user01‘@‘host‘;

用户授权mysql> grant select,update on *.* to ‘user01‘@‘localhost‘ identified by ‘123123‘; #给用户user01添加对所有库和表拥有select,update权限

取消用户授权mysql> revoke update on *.* from ‘user01‘@‘localhost‘; #对user01用户取消update权限

用户忘记密码1.修改配置文件systamctl stop mysqld.service       #关掉数据库vim /etc/my.cnf skip-grant-tables               #在mysqld这段最下面插入(跳过验证)systamctl start mysqld.service      #开启数据库2.直接进入数据库修改密码mysql         #直接进入数据库mysql> update mysql.user set authentication_string =passwordd(‘123123‘);mysql> quit3.测试登录数据库[[email protected] data]# mysql -uroot -p123123......   省略部分内容mysql>   #成功进入mysql数据库

MySQL database management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.