mysql(linux下)bug集结

时间:2023-12-10 15:53:14
Mysql
启动测试:
# systemctl status mysqld.service
mysql(linux下)bug集结mysql(linux下)bug集结
查看日志:
tail -n 200  /var/log/mysqld.log
2018-08-10T02:24:04.877063Z 0 [Warning] Can't create test file /data/mysql/VM_129_126_centos.lower-test
2018-08-10T02:24:04.906042Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
日志
mysql(linux下)bug集结mysql(linux下)bug集结
设置权限:
[root@VM_129_126_centos mysql]# sudo chmod 777 /data/mysql/
mysql(linux下)bug集结mysql(linux下)bug集结
再次测试:
mysql(linux下)bug集结mysql(linux下)bug集结
重启:
mysqld restart --user=root
 =================================================================================
create database jnshu default charset utf8;
停止
service mysqld stop
启动服务
service mysqld start
重启
service mysqld restart
mysqld --initialize --user=root
mysqld --user=root
mysqld restart --user=root
mysqld --skip-grant-tables
重启服务器
"jdbc:mysql://119.29.17.188/jnshu?useUnicode=true&characterEncoding=UTF-8&useSSL=false&rewriteBatchedStatements=true";
日志:
vim /var/log/mysqld.log
tail -n 100 /var/log/mysqld.log  

Packet for query is too large (12238 > 1024). You can change this value

show VARIABLES like '%max_allowed_packet%';
set global max_allowed_packet = 2*1024*1024*10
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
删除 /var/lib/mysql/mysql.sock
重新mysql -uroot -p
提示:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
停止
service mysqld stop
启动服务
service mysqld start
提示:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details
使用:
mysqld --user=root
重新连接
查看:
systemctl status mysqld.service
mysql(linux下)bug集结mysql(linux下)bug集结
journalctl -xe
mysql(linux下)bug集结mysql(linux下)bug集结
Can't create test file /data/mysql/VM_129_126_centos.lower-test
mysql(linux下)bug集结mysql(linux下)bug集结
vi /etc/selinux/config
mysql(linux下)bug集结mysql(linux下)bug集结
mysql(linux下)bug集结mysql(linux下)bug集结

摘抄:

下面为转:

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-11/137723.htm

1. 查看SELinux状态

1.1 getenforce

  • getenforce 命令是单词get(获取)和enforce(执行)连写,可查看selinux状态,与setenforce命令相反。
  • setenforce 命令则是单词set(设置)和enforce(执行)连写,用于设置selinux防火墙状态,如: setenforce 0用于关闭selinux防火墙,但重启后失效
    [root@localhost ~]# getenforce
    Enforcing

1.2 /usr/sbin/sestatus

Current mode表示当前selinux防火墙的安全策略
[root@localhost ~]# /usr/sbin/sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
SELinux status:selinux防火墙的状态,enabled表示启用selinux防火墙
Current mode: selinux防火墙当前的安全策略,enforcing 表示强

2. 关闭SELinux

2.1 临时关闭

setenforce 0 :用于关闭selinux防火墙,但重启后失效。
[root@localhost ~]# setenforce 0
[root@localhost ~]# /usr/sbin/sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28

2.1 永久关闭

修改selinux的配置文件,重启后生效。

打开 selinux 配置文件

[root@localhost ~]# vim /etc/selinux/config

修改 selinux 配置文件

将SELINUX=enforcing改为SELINUX=disabled,保存后退出
# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection.SELINUXTYPE=targeted
此时获取当前selinux防火墙的安全策略仍为Enforcing,配置文件并未生效。
[root@localhost ~]# getenforce
Enforcing

重启

[root@localhost ~]# reboot

验证

[root@localhost ~]# /usr/sbin/sestatus
SELinux status: disabled
[root@localhost ~]# getenforce
Disabled
mysql(linux下)bug集结mysql(linux下)bug集结