Linux安装地址:https://www.cnblogs.com/miskis/p/6038645.html
一、绿色版安装
1、下载MySQL 8.0.16,地址:http://dev.mysql.com/downloads/mysql/ (选择32位或者64位版本需根据自身PC情况)
2、解压到你自己的磁盘
3. 配置Path路径:系统属性 => 高级 => 高级 => 系统变量 => path后添加 (如:D:Toolsmysql-8.0.16-winx64in)
4. 在mysql根目录下新建 my.ini,此文件是初始化信息(默认mysql根目录不存此文件):
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = D:Toolmysql-8.0.20-winx64
datadir = D:Toolmysql-8.0.20-winx64data
port = 3306
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
# Windows下忽略大小写
lower_case_table_names=2
[WinMySQLadmin]
Server = D:Toolmysql-8.0.20-winx64inmysqld.exe
5. 以管理员身份打开“命令行窗口”,输入命令 mysqld --initialize-insecure --user=mysql
执行这条命令需要花一定的时间(大概几秒,根据电脑情况),不会有返回结果,但是可以在MySQL的安装目录下看到,原本为空的data文件夹里面有了许多文件和文件夹
6. 输入命令mysqld -install ,当看到Service successfully installed时,表示Mysql服务添加成功
7. 输入命令net start mysql,启动Mysql服务
8.
7、登录mysql后,修改密码(默认密码为空)
(1)以管理员身份打开“命令行窗口”,输入mysql -uroot -p并按下回车键
(2)在弹出Enter password: 时,继续按下回车键,即可登录mysql
(3)输入命令use mysql;
(4)输入命令ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码'; (注意末尾要有分号)
(5)输入命令flush privileges;
(6)输入命令exit;
到处安装完成!