查看Linux版本
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)因为Centos7 里面没有MysqL的yum源,重新下载建立yum源,然后创建MysqL数据库
[root@localhost ~]# wget @L_404_0@
[root@localhost ~]# rpm -ivh MysqL-community-release-el7-5.noarch.rpm
[root@localhost ~]# yum install MysqL-server
-
[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
重启MysqLd 服务
[root@localhost opt]# service MysqLd restart
-
[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> update user set password=password(“123456”) where user=’root’;
Query OK,4 rows affected (0.15 sec)
Rows matched: 4 Changed: 4 Warnings: 0MysqL> exit
Bye
[root@localhost opt]# 修改防火墙配置