Ubuntu下MySQL重裝問題

來源:互聯網
上載者:User

因操作失誤,在 Ubuntu下將Mysql卸載了,只得重新安裝,折騰了半天,沒有安裝上去,執行

#sudo apt-get remove mysql-server

#sudo apt-get install mysql-server

然後再執行/usr/bin/mysqld_safe &提示以下錯誤

Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

的確,在/var/run/mysqld下沒有mysqld.sock檔案, 然後還有一種錯誤是

/etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz

在/etc/下也沒有my.cnf檔案。到這裡沒辦法了,因為水平有限

最後終於找到一解決方案,執行

#sudo apt-get install mysql-server mysql-common

修改mysql登入密碼

#sudo mysqladmin -u root -p password ‘newpassword’

其主要是mysql-common包,my.cnf之類的檔案就是來自於mysql-common,不過在安裝前最好將其之前所有安裝過的mysql資料數理乾淨,以名安裝時出現其它之類的問題

又算是學了一招mysql的知識。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.