-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: No such file or directory解決辦法

今天安裝mysql5.6.12安裝有些許報錯,我在這裏貼出來,給大家分享一下:


安裝完成後,初始化數據庫報錯如下:

[root@localhost 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報錯如下:

[root@localhost 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用戶添加遠程訪問權限:

[root@localhost ~]# 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 root@'%' identified by 'your_password';                
Query OK, 0 rows affected (0.01 sec)



mysql> exit
Bye



[root@localhost ~]# /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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章