-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file相关的知识,希望对你有一定的参考价值。
安装完成后,初始化数据库报错如下:
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql
-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or
directory
貌似提示注释器错误,没有/usr/bin/perl文件或者档案,解决办法(安装perl跟perl-devel即可):
执行 yum -y install perl perl-devel
后在初始化数据库即可。
启动mysql报错如下:
[[email protected] mysql]# /etc/init.d/mysqld start
Starting MySQL.............. ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
查看日志文件有以下错误日志:
2013-08-08 13:07:44 21805 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.user‘ doesn‘t exist
130808 13:07:45 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
解决办法:cp ./support-files/my-default.cnf /etc/my.cnf 后再重启即可
根据度娘的结果,有大虾说是机器内存的问题,我在这里贴出其解决方案:
查看日志文件,看看有什么提示!
生成my.cnf
sudo cp support-files/my-medium.cnf /etc/my.cnf
#下面是安装使用过程中出现的一些问题及解决方法
一.不能用root用户运程连接mysql
*******************************************************************************
为MySQL的root用户添加远程访问权限:
[[email protected] ~]# mysql -uroot -p
Enter password: (此处输入密码登录)
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 35 to server version: 5.0.22
Type ‘help;‘ or ‘/h‘ for help. Type ‘/c‘ to clear the buffer.
mysql> grant all on *.* to [email protected]‘%‘ identified by ‘your_password‘;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
[[email protected] ~]# /etc/init.d/mysqld restart
*******************************************************************************
二.Mysqld启动失败
*******************************************************************************
1) mysql相关进程僵死
查找mysql相关进程:sudo ps ?A | grep mysql
杀死相关进程:sudo kill -9 process_id
重启mysqld:sudo /etc/init.d/mysqld restart
2)优化后出现
Starting MySQL..The server quit without updating PID file ([失败]ocal/mysql/data/localhost.localdomain.pid).
这个问题主要出现的原因是因为my.cnf的配置过于高,当前的机器无法满足,导致了MYSQL启动失败,估计以后也会有很多人遇到这个问题,网上的标准是:
如果内存是128M,则复制/usr/local/share/mysql/my-medium.cnf为/etc/my.cnf
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
如果内存是512M,则复制/usr/local/share/mysql/my-large.cnf为/etc/my.cnf
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
如果内存是1-2G,则复制/usr/local/share/mysql/my-huge.cnf为/etc/my.cnf
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
实际上需要在my-medium.cnf的基础上进行修改,增强部分配置,不能直接使用my-large.cnf和my-huge.cnf。
除非你的服务器配置相当高。
3)./mysql-bin.index not found
权限问题修改数据目录的权限及/usr/local/mysql/bin/mysqld 的权限。
4)Error Code : 1418
This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
(0 ms taken)
解决方法如下:
1. mysql> SET GLOBAL log_bin_trust_function_creators = 1;
2. 在my.ini(linux下为my.conf)文件中 [mysqld] 标记后加一行内容为 log-bin-trust-function-creators=1
http://blog.chinaunix.net/space. ... blog&id=2435868
以上是关于-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file的主要内容,如果未能解决你的问题,请参考以下文章