mysql安装配置
程序员文章站
2022-04-13 21:31:46
...
本来不打算写的,但是最近又安装了一次,每次安装都得百度一遍。。。所以还是自己写一篇,下次安装也不用再找别人的。。
1.下载
2.配置系统变量
MYSQL_HOME:D:\Java\mysql-8.0.18-winx64
Path变量里加上 %MYSQL_HOME%\bin
3.新建一个my-default.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.
[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.
port=3306
basedir=D:\Java\mysql-8.0.18-winx64
datadir=D:\Java\mysql-8.0.18-winx64\data
# port = .....
# 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
4.安装。。。
必须用管理员身份打开命令行。。
1)mysqld --initialize --console
这个命令会生成3中的data文件夹,所以如果安装失败重新安装的时候,执行此命令前先删掉data文件夹
这里红框部分是初始密码,第四步会用上
2) mysqld install mysql
这个命令的mysql是一个mysql服务代号,如果mysql已经存在,执行1)的时候会生成mysql2,因此这里的命令就要用对应的net install mysql2, 这里如果想删掉mysql2, 可以执行 mysqld -remove mysql2
3) net start mysql
启动mysql服务
4)登录mysql并修改密码
mysql -u root -p
输入刚刚1)中的密码....
修改密码: ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; // 记住你的密码是123456
退出: exit;
完成。。。。。
上一篇: python 8种必备的gui库
下一篇: 【算法笔记】递推方法及其例题讲解