当前位置:网站首页>MySQL創建遠程登陸用戶並授權
MySQL創建遠程登陸用戶並授權
2022-04-22 01:20:00 【qq_45858458】
MySQL 創建遠程登陸用戶並授權
用root連接上數據庫進行查看user錶的情况
mysql> select Host,User from mysql.user;
+-----------+---------------+
| Host | User |
+-----------+---------------+
| localhost | java_test |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
4 rows in set (0.00 sec)
一共又4個mysql賬號,Host列可以看出來,這些賬號只支持服務器本機連接,現在來創建一個遠程用戶;
mysql> create user test identified by '123456';
Query OK, 0 rows affected (0.00 sec)
mysql> select Host,User from mysql.user;
+-----------+---------------+
| Host | User |
+-----------+---------------+
| % | test |
| localhost | java_test |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
5 rows in set (0.00 sec)
創建完成,在程序裏面連接發現還是沒有權限,剛才我們知識創建了用戶,還沒有對這個用戶分配權限
mysql> grant all privileges on *.* to 'test'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected, 1 warning (0.00 sec)
all代錶接受所有操作,比如 select,insert,delete…; . 代錶所有庫下面的所有錶;% 代錶這個用戶允許從任何地方登錄;為了安全期間,這個%可以替換為你允許的ip地址;
然後刷新mysql用戶權限相關錶
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
版权声明
本文为[qq_45858458]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220055517634.html
边栏推荐
- Shallow comparison between oceanbase and tidb - implementation plan
- Yijingjie database will receive Chinese software investment of no more than 389 million yuan
- PR carries out JPEG frame compression and exports it as AVI video
- R language uses lmperm package to apply to the replacement method of linear model (replacement test, permutation tests), one-way covariance analysis (one-way ANCOVA) on the same data set, and one-way
- Interview questions for system engineers, college students, ant gold clothes on three sides
- Signal and system 2022 spring operation - the ninth operation
- PR如何对裁剪之后的视频进行resize,指定到期望大小?
- Redis personal notes: redis application scenario, redis common commands, redis cache breakdown and penetration, redis distributed lock implementation scheme, spike design idea, redis message queue, Re
- Huawei has launched the new BMW 7 Series in the application market to create a luxury peak smart travel experience
- EventBridge 集成云服务实践
猜你喜欢

2022年春招大厂面试升级笔记,光CRUD已经不能满足了

OBS录制的avi能够被imageJ打开吗?

How can zhiting connect Huawei smart speakers?
腾讯字节等大厂面试真题汇总,Android程序员怎么优雅迈过30K 这道坎

Tencent T3 team sorted out and was forced to start gnawing at the underlying technology

China venture capital, winter is coming

Servlet

观测云登陆阿里云计算巢,共建ISV新生态

Interview questions for system engineers, college students, ant gold clothes on three sides
![[high concurrency] Why is there a strange bug problem when writing long variables on a 32-bit multi-core CPU? After reading this article, I understand!](/img/66/5b03acd6653e84e43ea75cb2e2bae9.jpg)
[high concurrency] Why is there a strange bug problem when writing long variables on a 32-bit multi-core CPU? After reading this article, I understand!
随机推荐
Huawei has launched the new BMW 7 Series in the application market to create a luxury peak smart travel experience
(9)JVCL之Edit与打开文件、打开目录、选取时间、按钮、计算器、IP地址的合二为一
05 Lua 控制结构
Wonderful review | deepnova x iceberg meetup online "building a real-time data Lake based on iceberg"
物聯網專業未來沒有前途了嗎?
2022年4月21日,第14天
3D 沙盒游戏之人物的点击行走移动
Pytoch installation and troubleshooting of groupspatialsoftmax errors
Faster R-CNN代码详解 标注数据形状
Addition, deletion, modification and query of advanced MySQL data (DML)
华为应用市场登陆全新BMW 7系,打造豪华巅峰智慧出行体验
While hoarding goods, it's time to recognize cans again
Tencent Android development interview experience, HR's words pierced my heart
[observation] purple light cloud: homogeneous hybrid cloud is upgraded to distributed cloud, making cloud and intelligence everywhere
贼厉害,最新Android面试合集
量化交易之vnpy篇 - 同步模块避开自成交风险、新增同步完成提示
在setTimeout里设置倒数5秒计时的方法
Scan state in Mina
Bracket matching detection (20 points) C language
What do you need to know to join smart home?