sudo apt-get autoremove --purge MysqL-server-* sudo apt-get remove MysqL-server sudo apt-get autoremove MysqL-server sudo apt-get remove MysqL-common
清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
安装MysqL
sudo apt-get install MysqL-server #服务 sudo apt-get install MysqL-client #客户端 sudo apt-get install MysqL-workbench # 图形界面
查看MysqL是否正常运行
netstat -tap|grep MysqL
MysqL -u root -p #login sudo MysqLadmin -u root password newpassword #配置 MysqL 的管理员密码
附:安装指定版本的MysqL
apt-get install software-properties-common sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe' sudo apt-get update sudo apt install MysqL-server-5.6 sudo apt install MysqL-client-5.6 ---------------------------------------------------------- Errors were encountered while processing: sudo -s cd /var/cache/debconf rm *.dat apt-get update && apt-get upgrade
--------------------------------------------------------------------------------------
**********************************************************************************
一. 安装MysqL
1. 安装前先更新软件包列表:
$ sudo apt update
2. 在Ubuntu 16.04上安装MysqL:
$ sudo apt-get install MysqL-server-5.7
3.在安装过程中需要你输入MysqL 管理员用户(root)密码,如下图:
二. MysqL数据库基本使用
$ MysqL -u root -p
$ sudo systemctl stop MysqL.service
$ sudo systemctl start MysqL.service
$ sudo systemctl restart MysqL.service
5.查看MysqL运行状态:
$ sudo systemctl status MysqL.service
$ sudo vim /etc/MysqL/MysqL.conf.d/MysqLd.cnf
三. 安装MysqL-workbench
因为前面已经安装了MySQL,所以直接输入sudo apt-get install MysqL-workbench即可安装MysqL-workbench。
四. 设置禁止MysqL开机自启动(apt-get安装的MysqL默认是开机自启动的)
1.执行命令:
sudo update-rc.d MysqL disable
2.重启生效
sudo reboot