Centos 7 安装mysql数据库

  1. 查看Linux版本

    [root@localhost ~]# cat /etc/redhat-release
    CentOS Linux release 7.1.1503 (Core)

  2. 因为Centos7 里面没有MysqL的yum源,重新下载建立yum源,然后创建MysqL数据库

    [root@localhost ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

    [root@localhost ~]# rpm -ivh MysqL-community-release-el7-5.noarch.rpm

    [root@localhost ~]# yum install MysqL-server

  3. 登录数据库

    [root@localhost opt]# MysqL -u root
    ERROR 2002 (HY000): Can’t connect to local MysqL server through socket ‘/var/lib/MysqL/MysqL.sock’ (2)

    注意:/var/lib/MysqL的访问权限问题,将该文件夹的所有者改为root用户

    [root@localhost opt]# chown -R root:root /var/lib/MysqL

  4. 重启MysqLd 服务

    [root@localhost opt]# service MysqLd restart

  5. 重新登录MysqL

    [root@localhost opt]# MysqL -u root
    Welcome to the MysqL monitor. Commands end with ; or \g.
    Your MysqL connection id is 2
    Server version: 5.6.34 MysqL Community Server (GPL)

    copyright (c) 2000,2016,Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered Trademark of Oracle Corporation and/or its
    affiliates. Other names may be Trademarks of their respective
    owners.

    Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

    MysqL> use MysqL

    MysqL> update user set password=password(“123456”) where user=’root’;
    Query OK,4 rows affected (0.15 sec)
    Rows matched: 4 Changed: 4 Warnings: 0

    MysqL> exit
    Bye
    [root@localhost opt]#

  6. 修改防火墙配置

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native