ubuntu环境下以安装包形式安装mysql

前端之家收集整理的这篇文章主要介绍了ubuntu环境下以安装包形式安装mysql前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我的系统环境
Linux内核版本3.19.0-74-generic (uname -a命令查看)
发行版本Ubuntu 14.04.5 LTS(lsb_release -a命令查看)

用浏览器从官网上下载MysqL,注意与系统相匹配,得到MysqL-server_5.7.16-1ubuntu14.04_amd64.deb-bundle.tar

解压,使用tar命令解压:tar -zxvf FileName
这时候提示错误:gzip: stdin: not in gzip format;原因是这个压缩包没有使用gzip格式压缩,所以不用加z指令,直接使用tar -xvf FileName。参考网页1中还给出了另外一种方法,暂时没有尝试。

安装MysqL

更新设置到最新系统:
sudo apt-get update
sudo apt-get upgrade
因为后面的操作都是需要使用sudo来获得管理员权限,所以干脆直接获得管理员权限: sudo su
apt-get install libaio1

dpkg -i MysqL-common_5.7.16-1ubuntu14.04_amd64.deb
dpkg-preconfigure MysqL-community-server_5.7.16-1ubuntu14.04_amd64.deb (这里会让输入密码,还不能为空,一定需要输入的)
dpkg -i libMysqLclient20_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i libMysqLclient-dev_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i libMysqLd-dev_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i MysqL-community-client_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i MysqL-client_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i MysqL-common_5.7.16-1ubuntu14.04_amd64.deb
apt-get -f install (为了安装依赖包 libmecab2)

dpkg -i MysqL-community-server_5.7.16-1ubuntu14.04_amd64.deb
dpkg -i MysqL-server_5.7.16-1ubuntu14.04_amd64.deb

修改密码

在root权限下,直接输入MysqL然后回车,就可以进入到MysqL的环境中,然后
use MysqL;
UPDATE user SET password=password(“test123”) WHERE user=’root’;
到了修改密码这里,会提示错误:ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’
估计是因为MysqL版本的问题,新版本中已经去掉了password保留字(没有验证,只是猜想)。
update MysqL.user set authentication_string = password(‘123456’) where user=’root’;

禁止开机自启动


利用update-rc.d可以实现启动项的管理。例如,进入/etc/rc*.d目录之后,可以查看到所有的启动项。运行update-rc.d -f MysqL remove之后,再次进入/etc/rc.*.d目录之后,可以看到包含MysqL的那一项没有了。至于添加启动项,可以使用命令如:sudo update-rc.d apache2 defaults(这个未进行验证,参考网页4)。

安装workbench

在官网上面下载了deb包,使用dpkg -i FileName的形式进行安装,提示错误

dpkg: dependency problems prevent configuration of MysqL-workbench-community:
 MysqL-workbench-community depends on libatkmm-1.6-1v5 (>= 2.24.0); however:
  Package libatkmm-1.6-1v5 is not installed.
 MysqL-workbench-community depends on libcairo2 (>= 1.14.0); however:
  Version of libcairo2:amd64 on system is 1.13.0~20140204-0ubuntu1.1.
 MysqL-workbench-community depends on libcairomm-1.0-1v5 (>= 1.12.0); however:
  Package libcairomm-1.0-1v5 is not installed.
 MysqL-workbench-community depends on libglibmm-2.4-1v5 (>= 2.46.0); however:
  Package libglibmm-2.4-1v5 is not installed.
 MysqL-workbench-community depends on libgtkmm-2.4-1v5 (>= 1:2.24.0); however:
  Package libgtkmm-2.4-1v5 is not installed.
 MysqL-workbench-community depends on libncurses5 (>= 6); however:
  Version of libncurses5:amd64 on system is 5.9+20140118-1ubuntu1.
 MysqL-workbench-community depends on libodbc1 (>= 2.3.1); however:
  Package libodbc1 is not installed.
 MysqL-workbench-community depends on libpangomm-1.4-1v5 (>= 2.38.0); howeve
dpkg: error processing package MysqL-workbench-community (--install):
 dependency problems - leaving unconfigured

从字面上理解,安装此workbench,还需要一些依赖的软件环境,于是准备尝试用apt-get install libatkmm-1.6-1v5 这种方式来一个个地安装,来确保workbench的依赖环境正常,结果提示

Package libatkmm-1.6-1v5 is not available,but is referred to by another package.
This may mean that the package is missing,has been obsoleted,or
is only available from another source

E: Package 'libatkmm-1.6-1v5' has no installation candidate

于是直接采用apt-get的形式安装workbench
apt-get -f install(修复依赖关系(depends),如果直接apt-get install MysqL-workbench,当缺少依赖环境时,会提示进行这一步骤)
apt-get install MysqL-workbench(这期间会要求输入几次y/n,输入y即可)
然后在“search your computer and online resource”中就可以找到workbench,启动即可。

参考网页:
1. http://www.jb51.net/LINUXjishu/348664.html
2. http://www.cnblogs.com/tonyibm/p/5615586.html
3. http://blog.csdn.net/u010603691/article/details/50379282
4. Ubuntu启动项设置——之update-rc.d 命令使用http://www.jb51.cc/article/p-gvjtqxpn-bq.html

原文链接:https://www.f2er.com/ubuntu/355455.html

猜你在找的Ubuntu相关文章