ITPub博客

首页 > 数据库 > MySQL > mysql在linux及windows上安装及远程连接

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

MySQL 作者:linmenglan1 时间:2017-05-30 05:37:19 0 删除 编辑
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本机远程连接
(这边不必Windows一定要安装mysql数据库,只要有mysql数据工具即可连接Linux的mysql数据库)

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

其他的mysql 配置:
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

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31369373/viewspace-2140046/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-07-03

  • 博文量
    85
  • 访问量
    157914