Linux下安装mysql

安装前,需要卸载所有的mariadb软件: yum remove mariadb*

获取mysql的yum容器:wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

安装mysql的yum容器:rpm -ivh mysql-community-release-el7-5.noarch.rpm

加载容器清单到/var/cache/yum:yum list mysql-community-client

安装mysql服务:yum install mysql-community-client.x86_64 mysql-community-common.x86_64 mysql-community-devel.x86_64 mysql-community-libs.x86_64 mysql-community-server.x86_64

启动mysql:service mysqld start
sudo systemctl start tomcat 启动tomcat

设置密码:mysqladmin -u root password "accp"

登陆:mysql -u root -paccp

use mysql;
设置权限:grant all privileges on *.* to 'root'@'%' identified by 'accp';
刷新:flush privileges;

关闭firewall:service firewalld stop
      systemctl disable firewalld.service #禁止firewall开机启动

安装iptables防火墙: yum install iptables-services #安装
 vi /etc/sysconfig/iptables #编辑防火墙配置文件
   添加 -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

开启防火墙服务:service iptables start #开启
systemctl enable iptables.service #设置防火墙开机启动

posted @ 2018-06-30 13:41  后山人  阅读(158)  评论(0编辑  收藏  举报