问题1:
Starting MySQL...Manager of pid-file quit without updating[failue]
- 解决办法:
修改启动脚本文件:/etc/init.d/mysqld
conf=/usr/local/mysql/etc/my.cnf
问题2:
[root@localhost scripts]# ./mysql_install_db --user=mysql --datadir=/database/mydata
FATAL ERROR: please install the following Perl modules before executing ./mysql_install_db:
Data::Dumper
- 解决办法:
- [root@localhost scripts]# rpm -ivh /mnt/Packages/perl-Data-Dumper-2.145-3.el7.x86_64.rpm
warning: /mnt/Packages/perl-Data-Dumper-2.145-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:perl-Data-Dumper-2.145-3.el7 ################################# [100%] - 方案2
解决方法 :安装autoconf库
命令:yum-y install autoconf
linux 安装mysql 报错 :
Installing MySQL system tables.../usr/local/mysql//bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
安装 yum -y install libaio-devel 之后问题还是依旧 CentOS 7.3 64位
少东西,centos用yum装yum -y install numactl
问题3:
linux启动mysql报Fatal error:Can't change to run as user 'mysql' Please check that the user exists
- 解决办法:
1、创建mysql用户
useradd mysql
2、mysql目录改为mysql读写权限
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /usr/local/mysql
问题4
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/database/mydata
Installing MySQL system tables...2015-10-30 14:18:43 5981 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-30 14:18:43 5981 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-30 14:18:43 5981 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-30 14:18:43 5981 [Note] InnoDB: Memory barrier is not used
2015-10-30 14:18:43 5981 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-30 14:18:43 5981 [Note] InnoDB: Using CPU crc32 instructions
2015-10-30 14:18:43 5981 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-10-30 14:18:43 5981 [Note] InnoDB: Completed initialization of buffer pool
2015-10-30 14:18:43 5981 [Note] InnoDB: Restoring page 0 of tablespace 0
2015-10-30 14:18:43 5981 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
2015-10-30 14:18:43 5981 [ERROR] InnoDB: space header page consists of zero bytes in data file ./ibdata1
2015-10-30 14:18:43 5981 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2015-10-30 14:18:43 5981 [ERROR] Plugin 'InnoDB' init function returned error.
2015-10-30 14:18:43 5981 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2015-10-30 14:18:43 5981 [ERROR] Unknown/unsupported storage engine: InnoDB
2015-10-30 14:18:43 5981 [ERROR] Aborting
2015-10-30 14:18:43 5981 [Note] Binlog end
2015-10-30 14:18:43 5981 [Note] ./bin/mysqld: Shutdown complete
- 解决办法:
1.删除数据库目录下的文件ib_logfile0和ib_logfile1,我在安装时定义的数据库目录是/database/mydata
rm -rf /database/mydata/l
2.再次执行脚本
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/database/mydata
安装mysql 5.7过程中出现如下问题:
[root@db mysql-5.7]# bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql-5.7/ --datadir=/u01/data/mysql/
2018-12-25 18:46:40 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2018-12-25 18:46:40 [ERROR] Child process: /usr/local/mysql-5.7/bin/mysqldterminated prematurely with errno= 32
2018-12-25 18:46:40 [ERROR] Failed to execute /usr/local/mysql-5.7/bin/mysqld --bootstrap --datadir=/u01/data/mysql --lc-messages-dir=/usr/local/mysql-5.7/share --lc-messages=en_US --basedir=/usr/local/mysql-5.7
-- server log begin --
/usr/local/mysql-5.7/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
-- server log end --
解决方法:
下载文件numactl-2.0.9-2.el6.x86_64.rpm,然后安装即可。
文件下载地址:http://mirror.centos.org/centos/6/os/x86_64/Packages/numactl-2.0.9-2.el6.x86_64.rpm
[root@db soft]# chmod +x *.rpm
[root@db soft]# rpm -ivh numactl-2.0.9-2.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:numactl ########################################### [100%]
5、常见问题汇总:
- [root@iZ2zeg11g0cdei5171kqskZ mysql]# ./scripts/mysql_install_db --user=mysqlInstalling MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
- 解决:
yum -y install libaio-devel
- [root@iZ2zeg11g0cdei5171kqskZ mysql]# service mysqld startStarting MySQL.touch: cannot touch '/var/log/mariadb/mariadb.log': No such file or directorychmod: cannot access '/var/log/mariadb/mariadb.log': No such file or directorytouch: cannot touch '/var/log/mariadb/mariadb.log': No such file or directorychown: cannot access '/var/log/mariadb/mariadb.log': No such file or directory/usr/local/mysql//bin/mysqld_safe: line 129: /var/log/mariadb/mariadb.log: No such file or directory/usr/local/mysql//bin/mysqld_safe: line 166: /var/log/mariadb/mariadb.log: No such file or directorytouch: cannot touch '/var/log/mariadb/mariadb.log': No such file or directorychown: cannot access '/var/log/mariadb/mariadb.log': No such file or directorychmod: cannot access '/var/log/mariadb/mariadb.log': No such file or directory/usr/local/mysql//bin/mysqld_safe: line 129: /var/log/mariadb/mariadb.log: No such file or directoryThe server quit without updating PID file (/var/lib/mysql/i[FAILED]0cdei5171kqskZ.pid).
- 解决:(我们确实是没有/var/log/mariadb/mariadb.log 这个目录,这个是因为你没有指定他的配置文件的话,他会默认找到/etc/my.cnf 这个配置文件,因为我们修改了mysql的数据存储目录)、
rm -f /etc/my.cnf
- [root@iZ2zeg11g0cdei5171kqskZ mysql]# mysql -uroot -p-bash: mysql: command not found
- 解决:(这个是因为/usr/local/bin目录下缺失mysql导致,只需要一下方法建立软链接,即可以解决)
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
- sqlyog连接时,报1130错误,是由于没有给远程连接的用户权限问题
解决1:更改 ‘mysql’数据库‘user’表‘host’项,从‘localhost’改成‘%’。
use mysql;
select 'host' from user where user='root';
update user set host = '%' where user ='root';
flush privileges;解决2:直接授权
GRANT ALL PRIVILEGES ON . TO ‘root’@'%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION;
- -bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: 没有那个文件或目录
- 解决:
yum -y install perl perl-devel
- Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
- 解决:
yum -y install libaio-devel
环境变量配置位置:
vi + /etc/profile远程访问时要关闭防火墙或者打开mysql的端口,如果用的阿里云则要在服务器管理界面对端口进行设置,而不是在系统内部设置
9.问题描述:搭建完MySQL,用远程连接工具(Navicat)连接时报错:
2013-Lost connection to MySQL server at 'waiting for intial communication packet',system error:0
- 解决:
原因分析:
MySQL开启了DNS的反向解析功能,这样MySQL对连接的客户端会进行DNS主机名查找;
解决方式:
找到mysql安装配置文件:my.cnf;路径因环境而异。如果你的是Liunx的环境,可以去目录:/etc/my.cnf中查找
编辑文件:my.cnf,找到【mysqld】模块
在其下增加一行:skip-name-resolve 如下图所示:
保存退出,并重启mysql服务:service mysql restart 即可,再重新连接看看!
10.问题:[mysql]ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
第一种方法:
原因:在我的配置文件my.cnf中有这样一条语句
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
指定了严格模式,为了安全,严格模式禁止通过insert 这种形式直接修改mysql库中的user表进行添加新用户
解决办法:
将配置文件中的STRICT_TRANS_TABLES删掉,即改为:
sql_mode=NO_ENGINE_SUBSTITUTION
然后重启mysql即可
第二种方法:
grant usage on *.* to ['username'@'hostname'](mailto:'%20rel=) identified by 'passwd' with grant option; //添加用户
grant all privileges on *.* to ['username'@'hostname'](mailto:'%20rel=) identified by 'passwd'; //添加权限
flush privileges; //更新权限
11.问题: mysqldump导出数据库时 Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
分析:这个文件是初始化后生成到配置文件指定到的目录下的,
vim /etc/my.cnf
报错信息提示的路径跟配置的路径发现不一样,先查看这个文件存不存在,发现它是存在的,但是还是报错。根据它的提示,是去找默认的路径,/tmp下面的mysql.sock,但是我们指定的路径是在自己的安装目录下解决办法就是,设置软连接。解决:
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
(实际配置文件中的mysql.sock路径,软链接到/tmp/mysql.sock)
问题12: SELECT list is not in GROUP BY clause........ which is not functionally dependent on columns in GROUP BY clause;this is incompatible with sql_mode=only_full_group_by
分析:ONLY_FULL_GROUP_BY是MySQL提供的一个sql_mode,通过这个sql_mode来提供SQL语句GROUP BY合法性的检查,在MySQL的sql_mode是非ONLY_FULL_GROUP_BY语义时。一条select语句,MySQL允许target list中输出的表达式是除聚集函数或group by column以外的表达式,这个表达式的值可能在经过group by操作后变成undefined,而对于语义限制都比较严谨的多家数据库,如SQLServer、Oracle、PostgreSql都不支持select target list中出现语义不明确的列,这样的语句在这些数据库中是会被报错的,所以从MySQL 5.7版本开始修正了这个语义,就是我们所说的ONLY_FULL_GROUP_BY语义
查询全局sql_mode可得
select @@GLOBAL.sql_mode;
解决: 1 全局删除sql_mode中的
ONLY_FULL_GROUP_BY
选项
set @@GLOBAL.sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
2 修改mysql配置文件,在[mysqld]模块下添加如下代码
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
第一种方式会在重启mysql之后失效.请根据自己的需要选择解决方案
问题13:使用group_concat获取结果集字符串不全问题
分析:mysql的group_concat默认连接长度为1024字符,也就是说你需要连接后的连接超过1024字符,它只会显示这么长,其余部分都会被截取丢掉。
解决:
1.全局设置group_concat限制长度
#查询group_concat函数限制长度
SELECT @@global.group_concat_max_len;
show variables like "group_concat_max_len";
#使用以下语句设置:
SET GLOBAL group_concat_max_len=102400;
SET SESSION group_concat_max_len=102400;
2.在MySQL配置文件中my.conf或my.ini中添加如下代码然后重启MySQL服务
#[mysqld]
group_concat_max_len=102400
问题14:win10下手动启动mysql服务,显示Windows无法启动mysql服务(位于本地计算机上)。 错误1053:服务没有及时响应启动或控制请求。
mysql 1053错误,无法启动的解决方法
windows2003服务器中,服务器重启后Mysql却没有启动,手动启动服务时提示[1053]错误。
1.在DOS命令行使用
第一步:
mysqld-nt remove mysqlservice
#的方式卸载此服务,它提示卸载成功,(是英文成功的意思)
第二步:mysqld-nt install mysqlservice
#重新注册服务,一切恢复正常。(也会英文显示成功)
第三步:打开 服务>>>>禁用MYSQL>>>>再启动MYSQL
2.
”我的电脑“ -> 右击 ->“服务” -> 找到 mysql服务 ->右键 “属性” -> 选择“登录”选项卡 输入帐户名或者浏览用户名选择其用户名,输入密码和确认密码,点“确定
3.删掉 ib_logfile0,ib_logfile1两个日志文件就行了。(本人通过这个方法解决问题)
#如果找不到data文件夹,可以查看**mysql**文件目录**my.ini**文件,可以找到类似于 **datadir**=”D:/beeagle/Program Files/MySQL/MySQL Server 5.0/Data/”的字段 该路径为mysql data目录 默认在:”C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\Data\” **注意:Application Data****文件夹是隐藏的!!!**可以修改上述配置,把Data文件夹放在你想放的地方。
问题15: ERROR!MySQL is not running, but PID file exists
这个错误提示意味着mysql服务没有启动,但是PID文件仍然存在。这可能是由于mysql服务没有正确关闭或崩溃导致的。要解决这个问题,可以按照一下步骤操作:
- 确保MySQL服务已经停止。可以使用以下命令停止MySQL服务
sudo service mysql stop
- 删除PID文件
sudo rm /var/run/mysqld/mysqld.pid
- 启动MySQL服务
sudo service mysql start
如果仍然存在问题,可以查看MySQL日志文件(一般位于 /var/log/mysql/error.log)以获取更多信息
问题16: error! mysql is not running, but lock file (/var/lock/subsys/mysql) exists
这个错误消息表明 MySQL 没有正在运行,但是存在锁文件 (Narllock/subsys/mysal)。这可能是因为 MysQL 意外关闭或者未正确关闭导
致的。MySQL 数据库启动时需要在 Linux 系统中创建一个锁文件,以确保只有一个MysQL 进程在运行。如果 MysQL 在运行过程中崩溃或未正
常停止,该锁文件可能会残留在系统上,从而导致新的 MysQL 进程无法启动。这就是出现"error! mysql is not running, but lock file
(varllock/subsys/mysql) exists" 错误的原因。
解决:
1.检查 MysQL 进程是否正在运行。在终端中输入命令:
$ ps aux | grep mysq!
如果看到输出中有 MySQL 进程的信息,说明MySQL 已经在运行。否则,继续下一步。
- 检查 MysQL 锁文件是否存在。在终端中输入命令:
$ Is -I /var/lock/subsys/mysql
如果看到输出中有该文件,说明MySQL 锁文件确实存在。否则,可能是其他原因导致无法启动 MySQL.
- 删除 MysQL锁文件。在终端中输入命令:
$ sudo rm /var/lock/subsys/mysql
这会删除锁文件,允许新的 MySQL 进程重新启动。
- 启动 MySQL。在终端中输入命令:
$ sudo service mysql start
如果 MysQL 正常启动,就可以通过以下命令检查 MySQL 运行状态:
$ sudo service mysql status
总之,如果出现"error! mysal is not running, but lock file (/arllock/subsys/mysal) exists" 错误时,我们需要先检查 MySQL 进程和锁文件的状态,然后删除锁文件,重新启动 MySQL。如果问题仍然存在,那么可能是其他原因导致 My sQL 无法启动,需要进一步排查。
回答3:
该错误意味着MySQL数据库未能成功启动,但是系统上存在一个锁文件,这可能会阻止MySQL再次启动。
在Linux系统上,MySQL数据库可以通过两种方式运行:作为后台进程或作为系统服务
如果MySQL数据库作为一个系统服务运行,则MySQL服务将通过服务管理器启动,停止和重启,例如systemd或SysVinit。如果MySQL数
据库作为后台进程运行,则启动脚本将在/etclinit.d/mysqld文件中
在此情况下,错误信息表明MySQL数据库的进程已经停止了,但是锁文件因为之前的错误或异常情况而未被清除。这会阻止MySQL数据
库重新启动。
要解决这个问题,您的第一步是检查MySQL进程是否正在运行,您可以通过在终端上输入以下命令来检查:
$ sudo service mysal status
如果该命令提示您MySQL是stopped,那么进一步检查/Nar/log/mysql/error.log文件的错误消息,以确定导致MySQL服务停止的原因。
如果MySQL正在运行,那么您需要手动删除锁文件,以便MySQL可以重新启动。您可以使用以下命令:
$ sudo rm /var/lock/subsys/mysql
完成后,您可以尝试重新启动MySQL服务:
$ sudo service mysal start
如果您仍然无法启动MysQL,那么您需要进一步检查MySQL日志文件并解决潜在的问题或错误,以确保MySQL数据库能够正常运行。
Starting MySQL . ERROR! The server quit without updating PID file (/usr/local/mysql/data/macdeMacBook-Pro.local.pid).
It seems that you are facing an issue while starting MySQL. The error message suggests that the server quit without updating the PID
file. This can happen due to various reasons, such as improper shutdown of the server or permission issues with the PID file.
To resolve this issue, you can try the following steps:
- Check the permissions of the PID file: Ensure that the user running MySQL has the necessary permissions to read and write to the
PID file. You can use the 1s -1 command to check the permissions and make any necessary changes using the chmod
command. - Remove the existing PID file: If the PID file exists but is not being updated, you can try removing it. Run the following command to
remove the PID file:
sudo rm /usr/local/mysql/data/macdeMacBook-Pro.local.pid
- Start MySQL again: After removing the PID file, try starting MySQL again. Depending on your setup, you can use commands like
sudo service mysql start
#or
/usr/local/mysql/bin/mysqld_safe
#to start the server.
If the issue persists, it might be helpful to check the MySQL error logs for more information about the error. The logs are usually located
in the MySQL data directory or specified in the MySQL configuration file (my.cnf).
Please note that the steps provided here are general troubleshooting steps, and they may vary based on your specific setup and
operating system.