mysql远程连接

mysql安装后,默认情况下,远程连接是关闭的。

现在打开远程连接,步骤如下:

环境介绍如下:

宿主机是ubuntu,mysql安装在ubuntu里面了,安装了一个virtual-box,在里面装了一个window7虚拟机,现在想从windows里面连接ubuntu的mysql。

1、登陆ubuntu的mysql,执行以下命令:


grant all privileges on *.* to yangjianzhou@192.168.1.104 identified by "123456";


2、执行之后,立即刷新权限,命令如下:

flush privileges;


3、选择mysql数据库,执行以下命令:

select * from user \G;


可以看见包含以下输出:

Host: 192.168.1.104
User: yangjianzhou
Password: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: N
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin:
authentication_string: NULL



4、编辑/etc/mysql/my.cnf,注释bind 127.0.0.1

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#



5、重启mysql

sudo /etc/init.d/mysql restart
* Stopping MySQL database server mysqld [ OK ]
* Starting MySQL database server mysqld [ OK ]
* Checking for tables which need an upgrade, are corrupt or were
not closed cleanly.



6、windows连接mysql

[img]http://dl2.iteye.com/upload/attachment/0109/9276/f85afbe2-230d-3327-be90-132ce5b574b8.png[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值