1、msyql官方下载:https://downloads.mysql.com/archives/community/
2、选择对应mysql版本下载后解压。
3、在msyql目录中新建文件 my.ini
my.ini中的代码 (该文件是msyql的配置文件,具体参数意义可以自行百度)
[mysqld]
port = 3306 #端口号
basedir=C:/mysql/mysql-5.7.27-winx64/ #mysq的路径
datadir=C:/mysql/mysql-5.7.27-winx64/data #mysql的路径+\data
character-set-server=utf8
default-storage-engine=MyIsam
max_connections=1000
collation-server=utf8_unicode_ci
init_connect='SET NAMES utf8'
innodb_buffer_pool_size=64M
innodb_flush_log_at_trx_commit=1
innodb_lock_wait_timeout=120
innodb_log_buffer_size=4M
innodb_log_file_size=256M
interactive_timeout=120
join_buffer_size=2M
key_buffer_size=32M
log_error_verbosity=1
max_allowed_packet=16M
max_heap_table_size=64M
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=32M
read_buffer_size=512kb
read_rnd_buffer_size=4M
server_id=1
skip-external-locking=on
sort_buffer_size=256kb
table_open_cache=256
thread_cache_size=16
tmp_table_size=64M
wait_timeout=120
[mysql]
default-character-set=utf8 #编码
4、以管理员身份运行CMD将路径切换到您mysql的bin目录
5、输入安装命令 mysqld -install 若出现Service successfully installed,证明安装成功;
如果出现应用程序无法正常启动0xc000007b请点击确定关闭应用程序报错,请查看这篇文章。
https://blog.csdn.net/qq_39339179/article/details/125757747
6、继续输入命令:mysqld --initialize,此时不会有任何提示
7、再输入启动命令:net start mysql,出现以下提示证明MySQL启动成功:
8、在mysql中的data文件中找到 .err后缀的文件
mysql默认账户为root
msyql生成的随机密码就在该文件中
如下图所示,找到mysql生成的随机密码
9、登陆mysql 命令 mysql -hlocalhost -uroot -p (运行该命令后会提示输入mysql密码)
出现了welcome to the mysql 就代表了您已经成功登陆了数据库mysql
10、修改mysql数据库密码
mysql数据库修改密码 https://blog.csdn.net/qq_39339179/article/details/118800583
登陆数据库后运行命令修改数据库密码 set password for root@localhost = password('新密码');