centos6.5安装mysql5.7.x版本

    xiaoxiao2021-03-25  44

    1.检查是否已经安装过相关服务

    rpm -qa | grep -i mysql

    2.如果已经安装过,则先卸载之前的

    rpm -e --nodeps xxxx

    3.解压安装压缩包

    tar -zxvf mysql-5.7.11-1.el6.x86_64.rpm-bundle.tar

    4.安装

    rpm -ivh mysql-community-server-5.7.11-1.el6.x86_64.rpm mysql-community-common-5.7.11-1.el6.x86_64.rpm mysql-community-libs-5.7.11-1.el6.x86_64.rpm mysql-community-client-5.7.11-1.el6.x86_64.rpm

    5.启动数据库

    service mysqld start

    6.查看mysql相关进程

    ps -ef | grep mysql

    7.查看初始密码

    grep 'temporary password' /var/log/mysqld.log

    8.登录

    mysql -u root -p

    9.登录成功之后,修改validate_password_policy参数的值,用于密码修改的复杂度

    mysql> set global validate_password_policy=0;

    修改密码:

    mysql> alter user 'root'@'localhost' identified by 'xxxxx';

    10.修改允许远程访问数据库(默认是不允许远程访问的)

    vi /etc/sysconfig/iptables

    #新增如下语句

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

    11. 重启防火墙

    service iptables restart

    12.数据库授权

    mysql -u root -p

    mysql>grant all on *.* to root@'%' identified by 'xxxxx' --xxxx为root用户的密码

    13.重启数据库

    /etc/init.d/mysqld restart

    转载请注明原文地址: https://ju.6miu.com/read-34661.html

    最新回复(0)