删除 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 //这个很重要
上面的其实有一些是多余的。

清理残留数据

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
 
   
 
   
----------------------------------------------------------------------------
 
   
 
   
这里是正常的开始安装步骤:
 
   
1.在官网下载MysqL安装包
 
   

2.将包上传至服务器,并将该文件解压

解压命令为:

tar –xvf MysqL-server_5.6.28-1ubuntu14.04_amd64.deb-bundle.tar

解压后得到一系列的.deb文件。依次为:

libMysqLclient18_5.6.28-1ubuntu14.04_amd64.deb
libMysqLclient-dev_5.6.28-1ubuntu14.04_amd64.deb
libMysqLd-dev_5.6.28-1ubuntu14.04_amd64.deb
MysqL-client_5.6.28-1ubuntu14.04_amd64.deb
MysqL-common_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-bench_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-client_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-server_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-source_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-test_5.6.28-1ubuntu14.04_amd64.deb
MysqL-server_5.6.28-1ubuntu14.04_amd64.deb
MysqL-testsuite_5.6.28-1ubuntu14.04_amd64.deb

3.安装文件

这里这些文件存在着依赖关系,如果一个一个安装,要安装顺序来安装:

sudo dpkg -i MysqL-common_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libMysqLclient18_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libMysqLclient-dev_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i libMysqLd-dev_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i MysqL-community-server_5.6.28-1ubuntu14.04_amd64.deb

注意在安装MysqL-community-server会要求输入root账户密码

sudo dpkg -i MysqL-server_5.6.28-1ubuntu14.04_amd64.deb

到这里个人认为服务器应该可以使用了(未测试),但是MysqL命令还不能使用

sudo dpkg -i MysqL-community-client_5.6.28-1ubuntu14.04_amd64.deb
sudo dpkg -i MysqL-client_5.6.28-1ubuntu14.04_amd64.deb

到这里,MysqL的安装完成

还有几个文件没有用,用处现在不知道

MysqL-community-bench_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-source_5.6.28-1ubuntu14.04_amd64.deb
MysqL-community-test_5.6.28-1ubuntu14.04_amd64.deb
MysqL-testsuite_5.6.28-1ubuntu14.04_amd64.deb

 
   
安装过程中可能会提示缺少依赖包,这里安装依赖包就好  比如:
 
   
 
   
这里安装一下 libmecab2    可能会在这出现输入数据库的密码界面
 
   
@H_154_301@	
 
   
 
   
 
   
 
   
 
   
 
   
 
   
 
   

4.启动和停止MysqL服务命令

/etc/init.d/MysqL start
/etc/init.d/MysqL stop

MysqL的root账户,我在连接时通常用的是localhost或127.0.0.1,公司的测试服务器上的MysqL也是localhost所以我想访问无法访问,测试暂停. 解决方法如下: 1,修改表,登录MysqL数据库,切换到MysqL数据库,使用sql语句查看"select host,user from user ;" MysqL -u root -pvmwareMysqL>use MysqL; MysqL>update user set host = '%' where user ='root'; MysqL>select host,user from user; MysqL>flush privileges; 注意:最后一句很重要,目的是使修改生效.如果没有写,则还是不能进行远程连接. 2,授权用户,你想root使用密码从任何主机连接到MysqL服务器

GRANT ALL PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION; flush privileges;

如果你想允许用户root从ip为192.168.1.104的主机连接到MysqL服务器

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.104' IDENTIFIED BY 'admin123' WITH GRANT OPTION; flush privileges;

我装的版本是2.7.16 打开配置文件my.cnf 里面跟以前不一样了 好像是指向其他文件:
!includedir /etc/MysqL/conf.d/
!includedir /etc/MysqL/MysqL.conf.d/

     
     
网上找了下说是在/etc/MysqL/MysqL.conf.d里面,果然在路径/etc/MysqL/MysqL.conf.d/MysqLd.cnf是真实的配置文件路径
MysqLd.cnf配置如下: