簡述:此次主要是因爲搬遷機房,原來一臺09年的ubuntu安裝的9.x的系統,後來升級過內核爲10.x,上面服務配置混亂需要整理,領導想要升級系統,重裝跟以前服務器上一樣的軟件。由於年代久遠,現在系統升級爲16.x比較難找到老版本source.list源,試過離線自己做本地源,依賴解決不了,最後再國外找到一個比較全的源。安裝完成後,mysql沒有配置文件,自己手動自定義有問題,最後經過查找幫助配置文件,解決,具體如下
[client] port = 3306 socket = /var/run/mysqld/mysqld.sock default-character-set=utf8 [mysqld] port = 3306 socket = /var/run/mysqld/mysqld.sock
#一、不能創建mysqld.pid
#與my-innodb-heavy-4G.cnf比較,一定要修改成上面不然老是報錯
#[ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
#[ERROR] Can't start server: can't create PID file: Permission denied
skip-external-locking default-character-set=utf8 init_connect='SET NAMES utf8' key_buffer = 16M max_allowed_packet = 4M thread_stack = 256K thread_cache_size = 128 table_cache = 1024 thread_concurrency = 10 sort_buffer_size = 6M read_buffer_size = 4M join_buffer_size = 8M myisam_sort_buffer_size = 16M tmp_table_size = 128M query_cache_limit = 4M query_cache_size =32M set-variable = innodb_buffer_pool_size= 4G set-variable = innodb_additional_mem_pool_size=64M myisam-recover = BACKUP max_connections = 1000 expire_logs_days = 10 max_binlog_size = 100M skip-federated
#二、鏈接文件修改配置文件錯誤
#另外注意這幾個文件的連接情況
root@ubuntu16-slyey:/etc/mysql# ls -al /etc/mysql/my.cnf.fallback -rwxr-xr-x 1 root root 833 Jan 11 15:17 /etc/mysql/my.cnf.fallback root@ubuntu16-slyey:/etc/mysql# ls -al /etc/alternatives/my.cnf.fallback lrwxrwxrwx 1 root root 26 Jan 11 14:56 /etc/alternatives/my.cnf.fallback -> /etc/mysql/my.cnf.fallback root@ubuntu16-slyey:/etc/mysql# ls -al /etc/mysql/my.cnf lrwxrwxrwx 1 root root 33 Jan 11 13:43 /etc/mysql/my.cnf -> /etc/alternatives/my.cnf.fallback
#三、排錯方法
#重要的排錯方法
#systemctl status mysql.service #查看狀態信息
#journalctl -xe #查看具體錯誤信息
#四、mysql幫助文檔查看,最後找到解決方法
#dpkg -L softname #dpkg -s softname #dpkg -S softname #aptitude #apt-file list softname #/usr/share/doc/mysql-server-5.0/examples/my-large.cnf.gz #/usr/share/doc/mysql-server-5.0/examples/my-small.cnf #/usr/share/doc/mysql-server-5.0/examples/ndb_mgmd.cnf #/usr/share/doc/mysql-server-5.0/examples/my-huge.cnf.gz #/usr/share/doc/mysql-server-5.0/examples/my-innodb-heavy-4G.cnf.gz
#我是通過my-innodb-heavy-4G.cnf.gz這個文件來修改的