r搭建redis mysql_Linux+Redis实战教程_day02_Linux系统上安装MySQL

Linux系统上安装MySQL

安装MySQL

卸载自带mysql

查询mysql的安装情况,可以直接使用了

rpm -qa | grep-imysql –-color

卸载原生的MySQL

rpm -e --nodeps mysql-libs-5.1.71-1.el6.i686

上传mysql到Linux

CRT远程连接软件中:alt+p 拖拽上传即可

b5380465ca64291af5806b66583ba822556.jpg

安装依赖(准备阶段已经安装过了)

yum -y install libaio.so.1 libgcc_s.so.1 libstdc++.so.6

yum  update libstdc++-4.4.7-4.el6.x86_64

安装mysql的服务端

安装服务端

rpm -ivh MySQL-server-5.5.49-1.linux2.6.i386.rpm

默认安装在usr目录中

[root@yejing ~]# rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm

Preparing... ###########################################[100%]

1:MySQL-server ########################################### [100%]PLEASE REMEMBERTO SET A PASSWORD FOR THE MySQL root USER!To do so, start the server, thenissue the following commands:/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h yejing password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installation

which will also give you theoption ofremoving the test

databasesand anonymous user created by default. This isstrongly recommendedforproduction servers.

See the manualformore instructions.

Please reportany problems with the /usr/bin/mysqlbug script!

Starting MySQL....[确定]

[root@yejing ~]#

安装mysql的客户端

rpm -ivh MySQL-client-5.5.49-1.linux2.6.i386.rpm

[root@yejing ~]# rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm

Preparing... ###########################################[100%]

1:MySQL-client ########################################### [100%]

[root@yejing ~]#

启动mysql的服务

启动MySQL服务

service mysql start

设置mysql初始密码并登陆MySQL

/usr/bin/mysqladmin -u root password '123456'

设置开机自动启动mysql

加入到系统服务:

chkconfig --add mysql

自动启动(关闭):

chkconfig mysql on/off

开启远程服务

1bd3b8d9235583c45f886301c79d37769b9.jpg

登录mysql:

//赋予root用户所有权限,远程登录密码是123456

grant all privileges on *.* to 'root' @'%' identified by '123456';

flush privileges;//刷新权限

设置Linux的防火墙

Linux防火墙默认拦截3306端口

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT//将3306端口进行防火墙的开启

/etc/rc.d/init.d/iptables save//防火墙重新刷新保存

[root@yejing ~]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

[root@yejing ~]# /etc/rc.d/init.d/iptables saveiptables:将防火墙规则保存到/etc/sysconfig/iptables:[确定]

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值