Advertisement

ubuntu18下使用deb安装mysql

阅读量:

说明

建议您在Ubuntu 18系统中配置MySQL 8数据库,请直接复制并执行这些命令序列。注意:由于网络环境复杂性,在获取软件包时,请注意检查连接状态。如果出现连接中断的情况,请及时重新获取对应的镜像文件。

下载

【搜狐镜像】,下载速度大概250KB

复制代码
    wget http://mirrors.sohu.com/mysql/MySQL-8.0/mysql-server_8.0.20-1ubuntu18.04_amd64.deb-bundle.tar
在这里插入图片描述

【华中镜像】
如果你网速够快,应该不用1分钟就可以下载完毕。

复制代码
    wget https://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-8.0/mysql-server_8.0.21-1ubuntu20.04_amd64.deb-bundle.tar

解压

复制代码
    tar xvf mysql-server_8.0.20-1ubuntu18.04_amd64.deb-bundle.tar

移除多余deb

复制代码
    rm mysql-community-test-debug_8.0.20-1ubuntu18.04_amd64.deb
    rm mysql-testsuite_8.0.20-1ubuntu18.04_amd64.deb
    rm mysql-community-test_8.0.20-1ubuntu18.04_amd64.deb
    rm mysql-community-server-debug_8.0.20-1ubuntu18.04_amd64.deb

预设值

linux表区分大小写问题解决

复制代码
    sudo debconf-set-selections <<< "mysql-server mysql-server/lowercase-table-names select Enabled"

安装

复制代码
    sudo dpkg -i *.deb

如果有错误

复制代码
    sudo apt update
    sudo apt upgrade
    sudo apt-get -f -y install

密码选择8风格还是5,你自行决定,这里选择了5.

在这里插入图片描述

登录

假定密码为root。

复制代码
    mysql -u root -p

输入 root

查看预设值

复制代码
    show variables where Variable_name='lower_case_table_names';
在这里插入图片描述

开启远程访问

复制代码
    user mysql
复制代码
    update user set host='%' where user ='root';
复制代码
    FLUSH PRIVILEGES;

配置

如果需要修改配置,自行修改 /etc/mysql/mysql.conf.d/mysqld.cnf即可。

停止

复制代码
    service mysql stop

启动

复制代码
    service mysql start

卸载

复制代码
    dpkg --list|grep mysql

把查询到的都卸载

复制代码
    sudo apt-get autoremove --purge libmysqlclient-dev   libmysqlclient21:amd64 mysql-client mysql-common   mysql-community-client   mysql-community-client-core       mysql-community-server     mysql-community-server-core     mysql-server      

全部评论 (0)

还没有任何评论哟~