ubuntu 安装离线mysql

一、下载MySQL
        到mysql网站下载相应的mysql安装包,我的mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
二、解压
       tar -xvf mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
      得到以下文件:
      libmysqlclient20_5.7.17-1ubuntu16.04_amd64.deb
      libmysqlclient-dev_5.7.17-1ubuntu16.04_amd64.deb
      libmysqld-dev_5.7.17-1ubuntu16.04_amd64.deb
      mysql-client_5.7.17-1ubuntu16.04_amd64.deb
      mysql-common_5.7.17-1ubuntu16.04_amd64.deb
      mysql-community_5.7.17-1ubuntu16.04_amd64.changes
      mysql-community-client_5.7.17-1ubuntu16.04_amd64.deb
      mysql-community-server_5.7.17-1ubuntu16.04_amd64.deb
      mysql-community-source_5.7.17-1ubuntu16.04_amd64.deb
      mysql-community-test_5.7.17-1ubuntu16.04_amd64.deb
      mysql-server_5.7.17-1ubuntu16.04_amd64.deb
      mysql-server_5.7.17-1ubuntu16.04_amd64.deb-bundle.tar
      mysql-testsuite_5.7.17-1ubuntu16.04_amd64.debsan
三、安装所需的包
      1、sudo dpkg -i mysql-common_5.7.16-1ubuntu16.04_amd64.deb
      2. sudo dpkg-preconfigure mysql-community-server_5.7.16-1ubuntu16.04_amd64.deb
            输入root密码     //就是你数据库的初始化密码
      3、sudo dpkg -i  libmysqlclient20_5.7.16-1ubuntu16.04_amd64.deb
      4、sudo dpkg -i  libmysqlclient-dev_5.7.16-1ubuntu16.04_amd64.deb
      5、sudo dpkg -i   libmysqld-dev_5.7.16-1ubuntu16.04_amd64.deb
      6、sudo dpkg -i   mysql-community-client_5.7.16-1ubuntu16.04_amd64.deb 
     【注意:安装此步前需要安装libaio1】        apt-get install libaio1
      7、sudo dpkg -i   mysql-client_5.7.16-1ubuntu16.04_amd64.deb
      8、sudo dpkg -i   mysql-common_5.7.16-1ubuntu16.04_amd64.deb
      9、sudo dpkg -i mysql-community-server_5.7.16-1ubuntu16.04_amd64.deb
     【注意:安装此步前需要安装libmecab2           apt-get install libmecab2
      10、sudo dpkg -i mysql-server_5.7.16-1ubuntu16.04_amd64.deb
四、安装完成,查看路径及依赖
whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /etc/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
五、查看版本
mysql --version
mysql  Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using  EditLine wrapper
六、登录
mysql -u用户名 -p密码
七、修改安装过程中的root初始密码
在mysql系统外,使用mysqladmin
# mysqladmin -u root -p password "123456"
Enter password: 【输入原来的密码】
mysql官网上下载mysql-server_5.7.21-1ubuntu14.04_amd64.deb-bundle.tar,然后进行离线安装,解压该安装包,会出现11个依赖包,按照顺序依次使用sudo dpkg -i 进行安装,中间会报错,显示缺少相应的依赖,具体如下: *******@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-client. (Reading database ... 208518 files and directories currently installed.) Preparing to unpack mysql-community-client_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-client (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-client: mysql-community-client depends on libaio1 (>= 0.3.93); however: Package libaio1 is not installed. dpkg: error processing package mysql-community-client (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Errors were encountered while processing: mysql-community-client 和 ********@ubuntu:/opt/mysql$ sudo dpkg -i mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb Selecting previously unselected package mysql-community-server. (Reading database ... 208598 files and directories currently installed.) Preparing to unpack mysql-community-server_5.7.21-1ubuntu14.04_amd64.deb ... Unpacking mysql-community-server (5.7.21-1ubuntu14.04) ... dpkg: dependency problems prevent configuration of mysql-community-server: mysql-community-server depends on libmecab2 (>= 0.996-1.1); however: Package libmecab2 is not installed. dpkg: error processing package mysql-community-server (--install): dependency problems - leaving unconfigured Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Processing triggers for ureadahead (0.100.0-16) ... ureadahead will be reprofiled on next reboot Errors were encountered while processing: mysql-community-server 附上依赖包安装顺序: 1.mysql-common_5.7.21-1ubuntu14.04_amd64.deb 2.libmysqlclient20_5.7.21-1ubuntu14.04_amd64.deb 3.libmysqlclient-dev_5.7.21-1ubuntu14.04_amd64.deb 4.libmysqld-dev_5.7.21-1ubuntu14.04_amd64.deb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值