最新版(8.0.15)MySQL免安装版配置

以前记得配置mysql是最简单轻松的东西,时隔两年再配感觉把自己配成了傻逼,特此来记录一下… 妈咪妈咪哄…

官网下载免安装版的,然后解压到指定文件夹.
首先配置环境变量: 将 mysql 文件夹下的 bin 文件夹路径添加到系统环境变量即可(添加到 path 里)

然后, 在mysql文件夹下新建 my.ini 文件,文件内容为:

[client]
port=3306
 
[mysql]
 
 
[mysqld]
port=3306
#此处改为你自己的安装路径
basedir="C:\mysql\mysql-8.0.15-winx64"
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
default-storage-engine=InnoDB
init_connect='set names utf8mb4'
#sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=512
 
tmp_table_size=18M
 
thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
#innodb_additional_mem_pool_size=2M
 
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
 
innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8

由于8.0+ 都是自动创建 data 文件, 所以在配置文件里不再需要设置 data 文件夹路径。
另外的注意点参考博文: https://www.51-n.com/t-4580-1-1.html 。内容如下(如有侵权,请联系笔者删除):

MySQL 8+ unknown variable query_cache_limit query_cache_size query_cache_type

MySQL system variables query_cache_limit, query_cache_size, query_cache_type were removed in MySQL 8.0.3, remove them from your MySQL configuration file, otherwise MySQL won’t get successfully started.

Another change is that in MySQL 8+ it is prohibited to start the server with a lower_case_table_names setting that is different from the setting used when the server was initialized. The restriction is necessary because collations used by various data dictionary table fields are based on the setting defined when the server is initialized, and restarting the server with a different setting would introduce inconsistencies with respect to how identifiers are ordered and compared.

配置好 my.ini 文件后,在管理员模式下的命令行里 cd 到 mysql 安装路径的 bin 目录下,依次执行如下命令:

mysqld --initialize --console
mysqld install
net start mysql

其中在执行完第一条命令后,如果有错误,在命令行窗口会显示错误的详细信息,根据错误信息再去找相应的解决方法;如果没有错误的话,显示如下:
在这里插入图片描述
其中红色标记为默认分配的登录密码,可以自己修改。
然后执行第二条进行安装,
第三条进行启动服务。
然后就成功启动喽。。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章