Home >Database >Mysql Tutorial >【linux】ubuntu14.04下安装mysql5.5_MySQL

【linux】ubuntu14.04下安装mysql5.5_MySQL

WBOY
WBOYOriginal
2016-06-01 11:52:221473browse

1.ubuntu下安装mysql需要一些命令

(1)sudo apt-get install mysql-server

安装过程中会出现如下窗口,需要用户输入相关的数据库密码:\

\

(2)sudo apt-get isntall mysql-client
(3)sudo apt-get install libmysqlclient-dev

安装完成之后,可以用下面的命令检查是否安装成功

sudo netstat -tap | grep mysql

 

通过上述命令检查之后,如果看到有mysql 的socket处于 listen 状态则表示安装成功。

 

tcp        0      0 localhost:mysql         *:*                     LISTEN      28385/mysqld  

2.登陆mysql可以输入如下命令:

mysql -u root -p

\

show databases;

show tables;

\

3.补充一些安装过程中的小知识

1. 删除mysql

 

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 (非常重要)

上面的其实有一些是多余的,建议还是按照顺序执行一遍

2. 清理残留数据

dpkg -l |grep ^rc|awk'{print $2}' |sudoxargs dpkg -P

3.ubuntu下启动/停止/重启 mysql

3.1使用service:

sudo service mysql stop

sudo service mysql start

sudo service mysql restart

\

3.2使用 mysqld 脚本启动

 

sudo /etc/init.d/mysql stop

sudo /etc/init.d/mysql start

sudo /etc/init.d/mysql restart

 

重启提示错误如下:

Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql start...

其实已经告诉怎么做了:用sudo service mysql start启动即可

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn