2022-11-10 389
本人用阿里云的云服务器搭建一个网站练习,不知道在Window Server 2012R2系统下如何搭建MySQL,经过度娘终于解决,所以再次记入步骤以防下次搭建忘记。
1、在MySQL官网下载软件压缩包
2、解压完后,放到相应的硬盘中,我放的位置是E盘。然后将解压后文件夹中的my-default.ini这个配置文件复制一份并将其命名为my.ini。然后将里面的内容修改为如下
# *** 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
port=3306
[mysqld]
port=3306
character_set_server=utf8
basedir ="E:\MySQL\mysql-5.7.17-winx64"
datadir ="E:\MySQL\mysql-5.7.17-winx64/data/"
tmpdir ="E:\MySQL\mysql-5.7.17-winx64/data/"
socket ="E:\MySQL\mysql-5.7.17-winx64/data/mysql.sock"
log-error="E:\MySQL\mysql-5.7.17-winx64/data/mysql_error.log"
character_set_server=utf8
#server_id = 2
#skip-locking
max_connections=100
table_open_cache=256
query_cache_size=1M
tmp_table_size=32M
thread_cache_size=8
innodb_data_home_dir="E:\MySQL\mysql-5.7.17-winx64\data"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16
innodb-autoextend-increment=1000
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M
explicit_defaults_for_timestamp=true
#sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
3、在dos下进入MySQL的bin文件夹中进行相关命令
分别输入以下3条命令:
mysqld -console
mysqld --initialize
mysqld install
配置成功后mysql根目录下会生成一个data文件夹。
4、修改密码
1. 到my.ini中, 在[mysqld]下添加一行skip-grant-tables(忽略授权表),再忘记root密码的时候,这是个很有用的参数.
2. 启动MySQL, 在DOS中输入 mysql -uroot -pu就是user,p自然就是password,记得u和p与后面的用户名密码间不要有空格.这里回车后,会让你输入一个密码,随便输入一个你的密码就可以.
3. mysql> update mysql.user set authentication_string=password('12345') where user='root' and Host = 'localhost'
;括号中是自己的密码.记得结尾有个分号.
4. mysql> flush privileges;
5. mysql> quit;
6. 回到配置文件中,删除skip-grant-tables这一行,保存重启mysql即可.
7. 之后修改密码,使用mysql>SET PASSWORD = PASSWORD('123456');
配置完成后就可以通过DOS进入Mysql。
以上所述是小编给大家介绍的云服务器Window Server 2012R系统安装MySQL的详细教程,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对77isp云服务器技术网的支持! 如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
原文链接:https://77isp.com/post/12972.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态