2011-01-09 127 views
1

我是mysql DB的新手。我試圖在Ubuntu 10.04上運行MYSQL服務器。通過新立得軟件包管理器我已經安裝了mysql版本:mysql-client-5.1未在Ubuntu操作系統上運行MYSQL - 錯誤2002

我想知道如何爲通過上述方式安裝的mysql-client軟件設置數據庫密碼。如果你可以在這方面給我啓發。

當我試圖運行這個數據庫,我遇到了如下錯誤:

[email protected]:/var/lib$ mysql 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 
[email protected]:/var/lib$ 

我提到他人發佈用戶similar question。我沒有通過建議的答案找到解決方案。

例如,當我試圖張貼了類似的問題解決方案,我得到了以下內容:

[email protected]:/var/lib$ service start mysqld 
start: unrecognized service 
[email protected]:/var/lib$ ps -u mysql 
ERROR: User name does not exist. 
********* simple selection ********* ********* selection by list ********* 
-A all processes      -C by command name 
-N negate selection     -G by real group ID (supports names) 
-a all w/ tty except session leaders -U by real user ID (supports names) 
-d all except session leaders   -g by session OR by effective group name 
-e all processes      -p by process ID 
T all processes on this terminal  -s processes in the sessions given 
a all w/ tty, including other users -t by tty 
g OBSOLETE -- DO NOT USE    -u by effective user ID (supports names) 
r only running processes    U processes for specified users 
x processes w/o controlling ttys  t by tty 
*********** output format ********** *********** long options *********** 
-o,o user-defined -f full   --Group --User --pid --cols --ppid 
-j,j job control s signal   --group --user --sid --rows --info 
-O,O preloaded -o v virtual memory --cumulative --format --deselect 
-l,l long   u user-oriented --sort --tty --forest --version 
-F extra full X registers  --heading --no-heading --context 
        ********* misc options ********* 
-V,V show version  L list format codes f ASCII art forest 
-m,m,-L,-T,H threads S children in sum -y change -l format 
-M,Z security data  c true command name -c scheduling class 
-w,w wide output  n numeric WCHAN,UID -H process hierarchy 
[email protected]:/var/lib$ which mysql 
/usr/bin/mysql 
[email protected]:/var/lib$ mysql 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) 

我甚至試過指http://forums.mysql.com/read.php?11,27769,84713#msg-84713但找不到任何有用的東西。

請讓我知道如何解決這個錯誤。

非常感謝你..

回答

2
[email protected]:/var/lib$ service mysqld start 

看起來你沒有安裝MySQL服務器封裝

sudo易於得到安裝mysql服務器

應該幫助

+0

謝謝您的回答以及我需要用來安裝服務器的確切命令。我無法在突觸管理器中找到這個..我想知道爲什麼..但反正終端做了我的工作.. – boddhisattva 2011-01-09 09:53:09

+0

開始和mysqld是在錯誤的順序 – Tosh 2013-10-18 13:22:16

2

這確實屬於serverfault。

無論如何,你安裝了mysql-client包,但你需要的是mysql-server包。客戶端只是命令行客戶端,而服務器是運行服務器本身的東西。

在Ubuntu上安裝它之後,你就可以開始,並通過阻止它作爲根:

/etc/init.d/mysql start 
/etc/init.d/mysql stop 
0

使用以下命令

dpkg -l mysql* | grep ii | awk '{ print $2 }' | sudo xargs apt-get remove --purge -y 

& &

sudo apt-get install mysql-server