在mysql官网下载数据库和ODBC驱动
默认安装
重命名my-default.init为my.ini,内容如下
# 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.
[client]
default-character-set=utf8
[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 = .....
# datadir = .....
# port = .....
# server_id = .....
basedir = "D:\soft\MySQL\MySQL Server 5.7"
datadir = "D:\soft\MySQL\MySQL Server 5.7\data"
# 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
初始化和启动Mysql服务
1.以管理员权限运行cmd
2.进入mysql的bin下
3.初始化,生成data文件夹
>mysqld --initialize-insecure (不设置root密码,建议使用)
>mysqld --initialize (生成一个随机的root密码)
3.安装MySql服务
>mysqld -install
4.启动mysql
>net start mysql
登陆mysql
>mysql -u root -p
第一次登录时无需密码直接回车登录
登录mysql之后,设置root密码
>set password for root@localhost = password('YourPassword');
或者使用mysqlamdin修改root密码
>mysqladmin -u root -p password NewPassword