2. 自己配置my.ini
[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
port=3306
basedir="D:/mysql-5.7.30-winx64/"
datadir="D:/mysql-5.7.30-winx64/data/"
character-set-server=utf8
default-storage-engine=INNODB
#支持 INNODB 引擎模式。修改为 default-storage-engine=INNODB 即可。
#如果 INNODB 模式如果不能启动,删除data目录下ib开头的日志文件重新启动。
sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=65535
#query_cache_size = 64M
#table_cache=256
#tmp_table_size=18M
thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K
#innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8
#binlog
server_id=1
log_bin = mysql-bin
binlog_format = ROW
#跳过密码验证
skip-grant-tables
3.以管理员身份运行 mysqld.exe --initialize
会在配置的data目录下生成数据库表:
4. 启动mysql.exe并作为服务启动:
./mysqld.exe --install MySQL7
net start MySQL7
5. 启动客户端:
mysql.exe
use mysql;
update user set authentication_string = password('hello123456'), password_expired = 'N', password_last_changed = now() where user = 'root';
然后注释掉skip-grant-tables 重启客户端;
6. 为远程连接用户赋予权限:
1、新建用户远程连接mysql数据库
grant all on *.* to root@'%' identified by 'hello123456' with grant option;
flush privileges;
允许任何ip地址(%表示允许任何ip地址)的电脑用admin帐户和密码(123456)来访问这个mysql server。
注意admin账户不一定要存在。
2、支持root用户允许远程连接mysql数据库
grant all privileges on *.* to 'root'@'%' identified by 'hello123456' with grant option;
flush privileges;