1)下载 mysql zip到本地并解压;
2)设置 解压路径\bin 到path , 便于在命令行执行 mysqld;
3)在 bin 的同级目录新建 my.ini 文件,并填写相应内容,如下:
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
#设置3306端口
port = 3306
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
max_allowed_packet=16M
# 设置mysql的安装目录
basedir=D:\\Program Files\\mysql-8.0.11-winx64
# 设置mysql数据库的数据的存放目录
datadir=D:\\Program Files\\mysql-8.0.11-winx64\\Data
# created and no character set is defined
default-character-set=utf8
# The default storage engine that will be used when create new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
# connection limit has been reached.
max_connections=1000
# slowdown instead of a performance improvement.
query_cache_type = 1
query_cache_size=256M
thread_concurrency = 8
query_cache_limit = 768M
# section [mysqld_safe]
table_cache=1024
tmp_table_size=128M
thread_cache_size=256
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=256M
key_buffer_size=512M
# Size of the buffer used for doing full table scans of MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=2M
#*** INNODB Specific options ***
innodb_additional_mem_pool_size=12M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=6M
innodb_buffer_pool_size=550M
innodb_log_file_size=110M
innodb_thread_concurrency=10
#This option makes InnoDB to store each created table into its own .ibd file.
innodb_file_per_table
4)以管理员运行cmd,
4.1)安装mysql 服务:mysqld --install;
4.2)初始化目录: mysqld --initialize-insecure 密码为空; 或 mysqld --initialize 密码随机;
查看 *.err 文件 ,有相应提示;
4.3) 启动 mysql服务: net start mysql ;
4.4)登录 mysql : mysql -hlocalhost -uroot -p ;
4.5)查看mysql 为什么无法启动—— mysqld --console 启动控制台打印启动日志