因为我们目前只有root,所以只能先用root登陆mysql,再新增用户:

$ bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> insert into mysql.user(Host,User,ssl_cipher,x509_issuer,x509_subject) values('localhost', 'wlf','','','');
Query OK, row affected (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec)

  接着我们给新用户wlf设置密码:

mysql> set password for 'wlf'@'localhost' = password('wlf123');
Query OK, rows affected, warning (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec)

  然后我们新建数据库,并给wlf用户赋予权限,登陆口令跟wlf的密码一致:

mysql> create database nacos_config;
Query OK, row affected (0.00 sec) mysql> grant all privileges on nacos_config.* to wlf@localhost identified by 'wlf123';
Query OK, rows affected, warning (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec)

  用wlf登陆后查看数据库,发现nacos_config已经建好了

[wlf@zjhz-cmread-test188 mysql]$ bin/mysql -u wlf -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| nacos_config |
+--------------------+
rows in set (0.00 sec)

5.7.27版本mysql新增用户的更多相关文章

  1. linux非root用户安装5.7.27版本mysql

    先下安装包,到mysql官网https://dev.mysql.com/downloads/mysql/选好安装包版本.操作系统类型(默认是最新版本,点击右边链接Looking for previou ...

  2. 解决MySQL新增用户无法登陆问题

    1. 新增用户 grant all on *.* to '库名'@'%' identified by '库名'; 2. 刷新授权表 flush privileges; 3. 删除空用户 use mys ...

  3. MySQL新增用户及赋予权限

    创建用户 USE mysql; #创建用户需要操作 mysql 表 # 语法格式为 [@'host'] host 为 'localhost' 表示本地登录用户,host 为 IP地址或 IP 地址区间 ...

  4. mysql新增用户无法登陆问题解决ERROR 1045 (28000)

    mysql增加新用户无法登陆解决方法 ERROR 1045 (28000): Access denied for user 'appadmin'@'localhost' (using password ...

  5. Mysql新增用户,权限管理

    MySQL 赋予用户权限命令的简单格式可概括为:grant 权限 on 数据库对象 to 用户 一.grant 普通数据用户,查询.插入.更新.删除 数据库中所有表数据的权利. grant selec ...

  6. mysql新增用户

    新开了个项目,数据库也想新搞个用户,先登陆mysql,看看原来都有哪些: root@wlf:/# mysql -uroot -p Enter password: Welcome to the MySQ ...

  7. MySQL新增用户以及数据库访问授权

    # mysql -u root -p # 允许本地 IP 访问 localhost, 127.0.0.1 # insert into mysql.user(Host,User,Password) va ...

  8. mysql新增用户并开启远程连接

    之前使用mysql一直使用root来连接登录数据库,现在想使用新的用户名来连接数据库,碰到数据连接不上的情况. 把这些记录下来,以备后用 1.首先,创建用户 CREATE USER 'xiazhenx ...

  9. mysql新增用户无法授权!? 解决方案

    先上解决方法  :) 创建用户cat 密码 CREATE USER '; 修改user表中的注册用户cat update user set host='%' where user='cat'; 授权: ...

随机推荐

  1. 你的一举一动,我可都看着!Linux超骚技巧三分钟Get

    今天看到一个超级叼的linux命令,可以完整记录屏幕上的命令与输出结果. 有人问这有什么叼的,不就是保存历史操作记录吗?我看看日志也能看出来. 不不不,我要说的“完整记录”包括第几秒执行什么命令,就像 ...

  2. Python 过滤a文件中每一行内容,保存到b文件中

    #coding=utf-8print 1#初始化文件crash_log.log with open('e:/1/crash_log.log','w')as f: f.close() def fw(se ...

  3. [Apio2010]patrol 巡逻

    1912: [Apio2010]patrol 巡逻 Time Limit: 4 Sec  Memory Limit: 64 MBSubmit: 2541  Solved: 1288[Submit][S ...

  4. 01-学习vue前的准备工作(let和const)

    es6语法:let和const es6新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效 <!DOCYTPE html> <ht ...

  5. 通过类型断言获取error类型,获得更详细的信息

    package main import ( "fmt" "os" ) func main() { f, err := os.Open("/test.t ...

  6. input重复上传图片失效的问题

    使用input的file来上传图片 如果是重复选择相同的图片就会失效 解决的办法就是当每次上传完图片后让input的值为空就可以解决了 附上代码 只需在末尾添加这句就行$(this).val(&quo ...

  7. shell编程练习题

    求2个数之和 计算1-100的和 将一目录下所有的文件的扩展名改为bak 编译当前目录下的所有.c文件: 打印root可以使用可执行文件数,处理结果: root's bins: 2306 打印当前ss ...

  8. SpringData like关键字不起作用

    使用springdata简单查询时,like关键字不起作用 Hibernate: select article0_.oId as oId1_2_, article0_.articleAbstract ...

  9. struts的带参数结果集

    action在forward过程中共享一个值栈,也就是一次request只有一个值栈,服务器端的forward对于客户端来说就是一次request,在forward过程就没必要再传参数了. 总结也就是 ...

  10. fluent中截取任意面的数据

    原版视频下载链接: https://pan.baidu.com/s/1c2aE740 密码: mf2i