可视化工具Navicat
IDEA
下载mysql
Windows下安装mysql
Linux下安装MYSQL
# 创建文件夹 mkdir /usr/local/mysql # 将下载好的压缩包复制过来或者使用命令直接下载 # wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz # 解压 tar -xvf mysql-8.0.25-linux-glibc2.12-x86_64.tar.xz # 重命名 mv mysql-8.0.25-linux-glibc2.12-x86_64 mysql8.0 # 添加用户组mysql groupadd mysql # 添加用户 mysql useradd -r -g mysql mysql # 创建数据目录以及赋予权限 mkdir -p /data/mysql chown mysql:mysql -R /data/mysql # 修改配置文件 vim /etc/my.cnf bind-address=0.0.0.0 port=3306 user=mysql basedir=/usr/local/mysql/mysql8.0 datadir=/data/mysql socket=/tmp/mysql.sock log-error=/data/mysql/mysql.err pid-file=/data/mysql/mysql.pid # character config character_set_server=utf8mb4 symbolic-links=0 explicit_defaults_for_timestamp=true # 初始化 cd /usr/local/mysql/mysql8.0/bin ./mysqld --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql/mysql8.0 --datadir=/data/mysql/ --user=mysql --initialize # 查看密码 cat /data/mysql/mysql.err # A temporary password is generated for root@localhost: 3oCwJ&)U4vZC 初始密码 # 启动mysql cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql service mysql start # Starting MySQL.. SUCCESS! 启动成功 # 登录连接 ./mysql -uroot -p # Enter password: 输入密码为上面的初始密码 3oCwJ&)U4vZC # 修改密码 alter user 'root'@'localhost' identified by '123456'; # 使root能再任何host访问 update user set host = '%' where user = 'root'; # 远程无法连接mysql,需要关闭防火墙 # 查看防火墙状态 firewall-cmd --state # 关闭防火墙 systemctl stop firewalld.service # 禁止开机自启 systemctl disable firewalld.service # 成功连接