deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 源码镜像 # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# 预发布软件源 # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
阿里源
1 2 3 4 5 6 7 8 9 10 11 12
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
# 源码镜像 # deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiver
更新
1 2
apt update apt upgrade
缺省 Ubuntu
安装 build-essential
1
apt install build-essential
配置 MySql
安装
1
apt install mysql-server
查看随机密码
1
cat /etc/mysql/debian.cnf
启动/停止
1 2 3
service mysql start service mysql stop service mysql restart
用户操作
删除
1
drop'name'@'host';
创建
1
CREATEUSER'name'@'host' IDENTIFIED BY'password';
刷新权限
1
FLUSH PRIVILEGES;
开启远程登陆
MySql 默认不允许远程登录,所以需要开启远程访问权限
只需将 host 字段设置为 % 即可
1 2 3
use mysql; updateuserset host ='%'whereuser='name'; FLUSH PRIVILEGES;
查看用户
1 2
use mysql; selectuser,host,plugin,authentication_string fromuser;
更改旧版验证方式
1
alteruser'name'@'%' identified with mysql_native_password by'password';
大小写敏感
需要做以下操作
删除现有数据
必须删除现有数据才有效
1 2 3
service mysql stop rm -rf /var/lib/mysql/ mkdir /var/lib/mysql/