windows 安装 mysql数据库

1、按照提示安装

    https://www.runoob.com/mysql/mysql-install.html
    更详细安装:https://www.runoob.com/w3cnote/windows10-mysql-installer.html

2、遇到的问题1

在windos 的cmd下安装mysql
在mysql的bin目录下面执行: mysqld --install
报错信息如下:
Install/Remove of the Service Denied
解决办法:
打开cmd.exe程序的时候选择“用管理员身份打开”

3、遇到的问题2

登录之后:mysql -u root -p登录之后,使用数据库报错。
报错信息如下:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
原因:windows下首次登录mysq时报1820的错误,是因为安装好mysql时密码有一个指定的默认值,需要重置密码才能正常使用数据库。
解决办法:
命令行:alter user 'root'@'localhost' identified by 'youpassword'; #修改密码
密码生效:flush privileges;  #刷新权限让修改的数据文件立即生效
即可正常使用。 
原文地址:https://www.cnblogs.com/lph970417/p/12720177.html