1. 程式人生 > >window 下mysql5.7.12安裝報錯記錄

window 下mysql5.7.12安裝報錯記錄

1)官網下載mysql5.7.17解壓

my-default.ini檔案命名為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]


# 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.
character-set-server=utf8
collation-server=utf8_general_ci
basedir = "D:\mysql-5.7.12"
datadir = "D:\mysql-5.7.12\data"
port = 3306
# 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 


[mysql]
default_character_set=utf8


[mysql.server]
default_character_set = utf8


[mysqld_safe]
default_character_set = utf8


[client]

default_character_set = utf8

-----------------------------------------------------------------------------------------------

2)安裝服務:

mysqld -install mysql

net start mysql

直接用命令初始化:

指定配置檔案:mysqld --install mysql --defaults-file="D:\mysql-5.7.12\my.ini
初始化:mysqld --defaults-file=D:\mysql-5.7.12\my.ini --initialize 

3)修改密碼:

mysqld --skip-grant-tables 啟動mysql

開啟新的cmd:mysql -u root mysql

mysql> UPDATE user SET password=PASSWORD('root') WHERE user='root';

4)遠端登陸mysql

例如,你想myuser使用mypassword從任何主機連線到mysql伺服器的話。


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;


FLUSH   PRIVILEGES;


如果你想允許使用者myuser從ip為192.168.1.6的主機連線到mysql伺服器,並使用mypassword作為密碼


GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;


FLUSH   PRIVILEGES;

OK