Home  >  Article  >  Database  >  ubuntu12.04 卸载和安装mysql

ubuntu12.04 卸载和安装mysql

WBOY
WBOYOriginal
2016-06-07 15:39:381584browse

卸载mysql 第一步 1 sudo apt-get autoremove --purge mysql-server-5.0 2 sudo apt-get remove mysql-server 3 sudo apt-get autoremove mysql-server 4 sudo apt-get remove mysql-common (非常重要) 第二步:清理残留数据 1 dpkg -l | grep ^rc| awk '{pri

卸载mysql

第一步

1 sudo apt-get autoremove --purge mysql-server-5.0

2 sudo apt-get remove mysql-server

3 sudo apt-get autoremove mysql-server

4 sudo apt-get remove mysql-common (非常重要)
第二步:清理残留数据

1 dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

第三步:安装 mysql

1 sudo apt-get install mysql-server

2 sudo apt-get install mysql-client

3 sudo apt-get install php5-mysql(安装php5-mysql 是将php和mysql连接起来 )

一旦安装完成,MySQL 服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行:

1 sudo netstat -tap | grep mysql

当您运行该命令时,您可以看到类似下面的行:

tcp 0 0 localhost.localdomain:mysql *:* LISTEN -

如果服务器不能正常运行,您可以通过下列命令启动它:

1 sudo /etc/init.d/mysql restart
第四步:配置管理员密码

进入mysql

1 $mysql -uroot -p 管理员密码

配置 MySQL 的管理员密码:

1 sudo mysqladmin -u root password newpassword
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
Previous article:MySQL中修改root密码Next article:mysql的局域网连接