1 Windows
windows下的安装。
1.1 下载
进入https://www.mysql.com/downloads/
1)选择社区版本
2)选择MySQL Community Server
3)选择8.4.1 LTS版本,选择对应操作系统(LTS为长期支持版本,会持续维护更新)
4)Windows选择MSI Installer安装包
5)点击“No thanks, just start my download.”
2 安装与配置
选择Custom安装到指定目录:
安装完成后勾选Run MySQL Configurator进入配置页面:
1)Data Directory:数据写入的磁盘。
2)Type and Networking:配置端口号
3)Accounts and Roles:配置默认帐号root的密码,可配置为:Abcd@1234,同时也可以添加其它用户
4)Windows Service:为MySQL配置windows服务;
Start the MySQL server at System Startup,开机启动项,建议关闭,关掉后,启动本机的MySQL服务:右下角搜索并点击“服务”,找到MySQL服务,右键 > “启动”
5)其它配置默认即可
6)安装完成后,右下角搜索并点击“环境变量”,“编辑系统环境变量 > 环境变量 > 系统变量 > Path”,若没有mysql的环境变量,则新建,将mysql安装目录的bin目录路径配置上去。打开命令行窗口,执行:mysql --version查看是否配置成功。
7)在命令行窗口输入mysql -u root -p,提示符中输入密码即可进入mysql的命令行窗口,执行如下操作,让root帐号可使用ip连接:
use mysql;
update user set host = ‘%’ where user = ‘root’;
GRANT XA_RECOVER_ADMIN ON *.* TO root@‘%’;
FLUSH PRIVILEGES;
commit;
FAQ
1 requires Visual Studio 2019 x64
安装报错:This application requires Visual Studio 2019 x64 Redistributable. Please install the Redistributable then run this installer again.
解决方法:需要安装VC_redist.x64,进入https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170,点击如下链接下载、安装、重启即可: