CentOS7 安装 MySQL5.6.26

CentOS7 安装 MySQL5.6.26

  1. 下载包

    wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
    rpm -ivh mysql-community-release-el7-5.noarch.rpm
  2. 安装

    yum install mysql-community-server
  3. 开启MySQL

    systemctl start mysql
  4. 初始化mysql(可以用)

    mysql_secure_installation

    这里如果提示创建密码则创建,否则执行下一步

  5. 连接MySQL

    mysql -u root -p
  6. 创建远程链接账号(连接上数据库后在执行以下代码)

    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

    (root是用户名,%是所有ip允许,youpassword是用户密

  7. 命令

    systemctl start mysql # 开启
    systemctl stop mysql # 关闭
    systemctl restart mysql # 重启
    systemctl status mysql # 状态
    systemctl enable mysql # 开启自启动
    systemctl disable mysql # 关闭自启动
  8. 相关文章

    CentOS7 安装 apache2.4
    CentOS7 安装 MySQL5.6.26
    CentOS7 安装 PHP7


标签: centos mysql linux

发表评论: