1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > MySql:从任何主机授予根用户登录权限

MySql:从任何主机授予根用户登录权限

时间:2022-11-06 16:52:44

相关推荐

MySql:从任何主机授予根用户登录权限

Note that this is Not very secure, and should only be used for a local development box where you don’t feel like setting up individual permissions, but still need to connect from other machines.

请注意,这不是很安全,仅应用于您不想设置个人权限,但仍需要从其他计算机连接的本地开发箱。

To configure this feature, you’ll need to update the mysql user table to allow access from any remote host, using the % wildcard.

要配置此功能,您需要使用%通配符更新mysql用户表,以允许从任何远程主机进行访问。

Open the command-line mysql client on the server using the root account.

使用根帐户打开服务器上的命令行mysql客户端。

mysql -uroot

mysql -uroot

Then you will want to run the following two commands, to see what the root user host is set to already:

然后,您将需要运行以下两个命令,以查看root用户主机已设置为什么:

use mysql;select host, user from user;

使用mysql;从用户中选择主机,用户;

Here’s an example of the output on my database, which is pretty much the default settings. Note that ubuntuserv is the hostname of my server.

这是数据库输出的示例,几乎是默认设置。 请注意,ubuntuserv是我的服务器的主机名。

mysql> use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changed

mysql>使用mysql;读取表信息以完成表和列名可以通过更改-ADatabase来关闭此功能以更快地启动

mysql> select host,user from user;+—————+——————+| host | user |+—————+——————+|ubuntuserv | root | | localhost | debian-sys-maint | | localhost | root | +—————+——————+3 rows in set (0.00 sec)

mysql>从用户中选择主机,用户; + —————— + —————— + | 主机| 用户| + —————— + —————— + | ubuntuserv | 根| | 本地主机| debian-sys-maint | | 本地主机| 根| + —————— + —————— ++ 3行(0.00秒)

Now I’ll update the ubuntuserv host to use the wildcard, and then issue the command to reload the privilege tables. If you are running this command, substitute the hostname of your box for ubuntuserv.

现在,我将更新ubuntuserv主机以使用通配符,然后发出命令以重新加载特权表。 如果您正在运行此命令,请用方框的主机名代替ubuntuserv。

update user set host=’%’ where user=’root’ and host=’ubuntuserv’;flush privileges;

更新用户集host ='%',其中user ='root'和host ='ubuntuserv';刷新权限;

That’s all there is to it. Now I was able to connect to that server from any other machine on my network, using the root account.

这里的所有都是它的。 现在,我可以使用根帐户从网络上的任何其他计算机连接到该服务器。

Again, note this isn’t very secure, and you should at least make sure that you’ve set a root password.

再次提醒您,此操作不是很安全,并且至少应确保已设置root密码。

翻译自: /howto/programming/mysql-give-root-user-logon-permission-from-any-host/

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。