安装软件
搜索 ubantu系统 和在线shell 软件
连接本机ubantu 系统
搭建环境 - mysql
lsb_release -a 查看 ubantu系统
配置列表源
deb http://mirrors.aliyun.com/ubuntu/ XXXXX main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ XXXXX-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ XXXXX-backports main restricted universe multiverse
xxxxx = focal
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse
选择合适的源,替换原文件的内容,保存编辑好的文件
安装 mysql
查看有没有安装MySQL:
dpkg -l | grep mysql
安装MySQL:
apt install mysql-server
netstat -tap | grep mysql
启动mysql 报错 su: warning: cannot change directory to /nonexistent: No such file or directory
Ubuntu
sudo service mysql stop sudo usermod -d /var/lib/mysql/ mysql sudo service mysql start
CentOS
sudo systemctl stop mysql.service sudo usermod -d /var/lib/mysql/ mysql sudo systemctl start mysql.service
原因:这种错误一般是 mysql 服务器异常关机导致的
MySQL在安装时会创建很多默认用户,其中就包含一个 debian-sys-maint,并且创建了该用户的随机密码,存储该用户信息的文件位于 /etc/mysql/debian.cnf文件中
启动 mysql service mysql start 查看线程是否启动 :netstat -an | grep 3306 如果没有netstat配置,可以通过 ps -ef | grep mysql
查看配置文件 vim /etc/mysql/mysql.conf.d/mysqld.cnf 如果本机连接就不需要做本机解绑处理 移除 bind-address
登录mysql mysql -u root -p
show databases; 就可以查看当前的所有数据库。
更新 mysql user 权限信息 select user,host,plugin from user;
更新 mysql user 权限信息
ALTER USER ‘root’@‘%’ IDENTIFIED WITH mysql_native_password BY ‘123456’; 更新ROOT 本地密码为 123456
刷新 flush privileges;
连接
搭建环境 redis
安装redis
sudo apt-get install -y redis-server
sudo vim /etc/redis/redis/redis.conf
修改配置文件里的requirepass 密码 123456
service redis-server restart redis-cli
AUTH 123456
|