前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Ubuntu14.04下如何开启Mysql远程访问

Ubuntu14.04下如何开启Mysql远程访问

作者头像
静默加载
发布2020-05-31 10:07:21
1K0
发布2020-05-31 10:07:21
举报

在目录/etc/mysql下找到my.cnf,用vim编辑,找到my.cnf里面的

代码语言:javascript
复制
#bind-address           = 127.0.0.1

将其只能本地ip访问的代码进行注释

然后用root登陆Mysql数据库

代码语言:javascript
复制
im@58user:~$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.5.53-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2016, 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> 

然后在执行

代码语言:javascript
复制
mysql> grant all on *.* to root@'%' identified by '123';
myslq> flush privileges;

最后就可以在远程用刚才创建的用户和密码登陆mysql。

在执行对用户授权密码的时候可能会遇到下面的错误:

代码语言:javascript
复制
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

解决方法:

先刷新一下权限表。 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> grant all on cactidb.* to dbuser@'localhost' identified by '123'; Query OK, 0 rows affected (0.00 sec)

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档