在自己电脑上玩一个mysql 在官网下载了,发现压缩包里面没有data文件夹,各种搜索都是copy一个data文件夹。这让我去那里copy。
终于找到一个 初始化的命令,mark。
命令行执行: mysqld --initialize --user=mysql --console
先执行以上命令, 生成库. 注意有个临时密码, 要记下来.
然后启动服务.
然后再命令行:
mysql -uroot -p
输入密码,
再输入:
set password = password('root')
mysql
移除服务
mysqld -remove
安装服务
mysqld -install
关闭服务
net stop mysql
启动服务
net start mysql
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.
[mysqld]
port = 3306
#设置字符集为utf8
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_general_ci
#创建表区分大小写,保持和linux 同意
lower_case_table_names = 2
basedir=D:/ProgramFiles/mysql/mysql-5.7.10-winx64
datadir = D:/ProgramFiles/mysql/mysql-5.7.10-winx64/data
# 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 = .....
# 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
[client]
port = 3306
default-character-set=utf8