我另篇blog有提到修改完my.cnf文件後mysql server從新啓動失敗,就是說mysql server啓動不起來了,因而我就想到重裝再試試,沒想到就行了。mysql
重裝mysql以前須要卸載乾淨,刪除mysql:sql
~$ sudo apt-get autoremove --purge mysql-server-5.0 (根據以前安裝版本) ~$ sudo apt-get remove mysql-server ~$ sudo apt-get autoremove mysql-server ~$ sudo apt-get remove mysql-common
上述代碼的第一步(即:sudo apt-get autoremove --purge mysql-server-5.0)可執行可不執行,由於我不知道本身以前安裝的版本= =因此就沒有執行第一步。服務器
清理殘留的數據:tcp
~$ dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
這樣就將mysql完全卸載了,下面就該安裝新的mysql:spa
~$ sudo apt-get install mysql-server
安裝過程會彈出提示框,輸入root用戶的密碼。code
安裝完成後,MySQL服務器會自動啓動,下面爲檢查MySQL服務器程序:server
~$ ps -aux|grep mysql mysql 3205 2.0 0.5 549896 44092 ? Ssl 20:10 0:00 /usr/sbin/mysqld conan 3360 0.0 0.0 11064 928 pts/0 S+ 20:10 0:00 grep --color=auto mysql ~$ netstat -nlt|grep 3306 tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN ~$ sudo /etc/init.d/mysql status Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql status Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the status(8) utility, e.g. status mysql mysql start/running, process 3205 ~$ sudo service mysql status mysql start/running, process 3205
轉載自本人ITeye連接:http://xiaozhuang0706.iteye.com/blog/2258381blog