mysql在linux及windows上安装及远程连接

1、mysql 在linux端安装

yum list installed mysql*  # 查看有没有安装过
yum -y install mysql-server  # 服务器端
yum -y install mysql-devel   # 服务器端
yum -y install mysql  # 客户端

2、mysql 在linux端配置

/etc/my.cnf 加入 default-character-set=utf8

# 启动mysql服务
service mysqld start 或 /etc/init.d/mysqld start
service mysqld restart

# 开机自动启动
chkconfig --list | grep mysql*
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list | grep mysql*

# 创建root管理员
mysqladmin -u root password 123456

# 试登录
mysql -u root -p123456
quit

mysql --version

3、开启远程访问

# 格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";
# (root,%)用于远程登录,而(root,localhost)用于本地登录
show databases;
describe mysql.user;
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "123456";
GRANT ALL PRIVILEGES ON *.* TO test@"%" IDENTIFIED BY "123456";
-- update mysql.user set host='%' where user = 'test';
select user,host,password from mysql.user;
flush privileges;

# Linux上打开3306端口
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/init.d/iptables save
service iptables restart

# Windows本机远程连接
1) 安装windows mysql
2) Windows版的配置:
http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html
3) mysql -h192.168.22.250 --port=3306 -uroot -p123456

Reference
http://jingyan.baidu.com/article/acf728fd10c3d6f8e510a3ef.html
http://zhidao.baidu.com/question/180138320.html
http://jingyan.baidu.com/article/63acb44add614761fcc17ec2.html
http://blog.csdn.net/chana1101/article/details/39641415
http://jingyan.baidu.com/article/95c9d20dac9040ec4f75617a.html

http://www.centoscn.com/CentOS/help/2013/0725/558.html


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值