当前位置:网站首页>Mysql应用安装后找不到my.ini文件
Mysql应用安装后找不到my.ini文件
2022-07-31 04:47:00 【geejkse_seff】
一、背景
我在两台电脑上安装了MySQL Server 8.0,准备继续做主从配置,这时候就需要用到my.ini文件进行配置,但是我找不到my.ini文件。
我的安装目录中没有my.ini文件。(这里我的mysql安装目录为C:Program FilesMySQLMySQL Server 8.0)。

那么我们就需要重新配置一下。
二、删除原有的mysql服务
因为我的mysql已经用了一段时间,我这里就删除服务重新配置。
删除方法。
进入mysql安装的bin目录。在路径栏输入cmd命令,即可进入命令提示符。

查看我们mysql服务的名字。(可以看到这里我们的服务名字是MySQLD514,服务名是自定义的,每个人的情况可能不一样,要自己插。)


命令如下:
# 删除已安装的mysql服务
sc delete MySQLD514
三、初始化mysql
# 初始化mysql
mysqld --initialize-insecure --user=mysql

四、自行添加my.ini文件
在bin文件夹同级目录,新建my.ini文件。

将下面脚本复制到my.ini文件
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/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.
[client]
default-character-set = utf8mb4
[mysql]
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_bin
init_connect='SET NAMES utf8mb4'
# 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:MySQL
datadir = D:MySQLdata
port = 3306
server_id = 1
# 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 = 16M
read_rnd_buffer_size = 16M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
五、新建mysql服务
输入命令,意思是创建一个名字为MySql的服务,相关配置文件为C:Program FilesMySQLMySQL Server 8.0my.ini
# 创建mysql服务
mysqld --install "MySql" --defaults-file="C:Program FilesMySQLMySQL Server 8.0my.ini"

再次打开服务,即可看到我们的MySql服务项。

六、启动mysql服务
可以在服务中直接启动,也可以在cmd中命令启动。命令为:
net start MySql

七、设置数据库密码
7.1 登录mysql数据库
在bin目录启动cmd。输入下命令。
mysql -u root -p
这时密码为空,不需要填写,直接回车:

7.2 修改root用户密码
设置root用户密码为123456
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

设置退出,再次登录,即可。
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- Understanding of the presence of a large number of close_wait states
- The Vue project connects to the MySQL database through node and implements addition, deletion, modification and query operations
- exsl文件预览,word文件预览网页方法
- Safety 20220718
- visual studio 那些提高效率的快捷键,总结(不时更新)
- ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
- Blockbuster | foundation for platinum, gold, silver gave nameboards donors
- mysql基础知识(二)
- el-image tag doesn't work after binding click event
- The MySQL database installed configuration nanny level tutorial for 8.0.29 (for example) have hands
猜你喜欢

三道leetcode上的oj题

Solved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined

(8) Math class, Arrays class, System class, Biglnteger and BigDecimal classes, date class

ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your

行业落地呈现新进展 | 2022开放原子全球开源峰会OpenAtom OpenHarmony分论坛圆满召开
![[debug highlights] Expected input batch_size (1) to match target batch_size (0)](/img/b3/ff6ccc3cd307befad3bd07a9f4a956.png)
[debug highlights] Expected input batch_size (1) to match target batch_size (0)

Thinking about data governance after Didi fines

【C语言】操作符详解

MySQL database must add, delete, search and modify operations (CRUD)

益智类游戏关卡设计:逆推法--巧解益智类游戏关卡设计
随机推荐
【py脚本】批量二值化处理图像
The input input box displays the precision of two decimal places
WPF WPF 】 【 the depth resolution of the template
MySQL数据库安装配置保姆级教程(以8.0.29为例)有手就行
Hand in hand to realize the picture preview plug-in (3)
微信小程序使用云函数更新和添加云数据库嵌套数组元素
【wpf】wpf中的那些模板之深度解析
Win10 CUDA CUDNN 安装配置(torch paddlepaddle)
MySQL基础操作
专访 | 阿里巴巴首席技术官程立:云+开源共同形成数字世界的可信基础
XSS shooting range (3) prompt to win
[py script] batch binarization processing images
C Implementation of Simple Network File Copy
unity2d小游戏
MySQL database backup
问题1:给你1-10的列表,实现列表输出,单数在左边,双数在右边。
PWN ROP
Error EPERM operation not permitted, mkdir 'Dsoftwarenodejsnode_cache_cacach Two solutions
Industry-university-research application to build an open source talent ecosystem | 2022 Open Atom Global Open Source Summit Education Sub-Forum was successfully held
VScode+ESP32 quickly install ESP-IDF plugin