rpm -qa | grep -i MysqL
rpm -e --nodeps MysqL-libs-5.1.61-4.el6.x86_64
2、rpm -ivh numactl-2.0.9-2.el6.x86_64.rpm
rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm
3、rpm -ivh MysqL-community-common-5.7.18-1.el6.x86_64.rpm
rpm -ivh MysqL-community-libs-5.7.18-1.el6.x86_64.rpm
rpm -ivh MysqL-community-client-5.7.18-1.el6.x86_64.rpm
rpm -ivh MysqL-community-server-5.7.18-1.el6.x86_64.rpm
为了保证数据库能正确处理中文,我们需要设定数据库默认的编码为utf8。修改/etc/my.cnf文件,并在其中加入以下内容:
[client]
default-character-set=utf8mb4
[MysqLd]
character_set_server=utf8mb4
5、修改时区
6、启动MysqL
service MysqLd start
MysqL -u root -p
7、在CentOS系统中防火墙默认是阻止3306端口的,现在开启3306端口
修改/etc/sysconfig/iptables 文件,添加以下内容:
查询防火墙状态:
[root@localhost ~]# service iptables status<回车>
停止防火墙:
[root@localhost ~]# service iptables stop <回车>
启动防火墙:
[root@localhost ~]# service iptables start <回车>
重启防火墙:
[root@localhost ~]# service iptables restart <回车>
永久关闭防火墙:
[root@localhost ~]# chkconfig iptables off<回车>
永久关闭后启用:
[root@localhost ~]# chkconfig iptables on<回车>
重启防火墙:
1)、重启后永久性生效:
开启:chkconfig iptables on
关闭:chkconfig iptables off
2)、即时生效,重启后失效:
开启:service iptables start
关闭:service iptables stop需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
------------------------------------华丽分割线---------------------------------------
启动MysqL的时候解决错误:Fatal error: MysqL.user table is damaged. Please run MysqL_upgrade.
1、rm -rf /var/lib/MysqL/
2、使用如下命令,重新初始化MysqL
MysqLd --initialize --user=MysqL
3、service MysqLd start
------------------------------------华丽分割线---------------------------------------
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) :表示没有生成root的临时密码
1、service MysqLd stop 停掉MysqL服务器
2、MysqLd_safe --user=MysqL --skip-grant-tables --skip-networking &
@L_301_8@
3、show databases;
use MysqL;
show tables;
4、update user set authentication_string=PASSWORD('root123!@#') where user='root';
flush privileges;
exit;
------------------------------------华丽分割线---------------------------------------
解决错误:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
1、SET PASSWORD = PASSWORD('root123!@#');
2、flush privileges;
3、exit;
原文链接:https://www.f2er.com/centos/377741.html