This is a direct way of extracting archive installed MySQL
1. download the compressed package
Download the official website: https://dev.mysql.com/downloads/mysql/
After downloading the archive file to extract the path you want to
2. Create my.ini file
Create a new my.ini file in the root directory of the unzipped
Edit the file content:
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\MySQL
# 设置mysql数据库的数据的存放目录
datadir=D:\MySQLData
# 允许最大连接数
max_connections=200
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
default-character-set=utf8
Installation file and directory modification data storage according to their own circumstances
3. Add the environment variable
As follows:
1) Right-click on My Computer -> Properties -> Advanced System Settings (Advanced) -> Environment Variables
Click the New button under System variables
enter the variable name: MYSQL_HOME
input variable value: D: \ MySQL
# mysql is the custom-extracting directory.
2) Path selection system variables
click on the Edit button to
add a variable value in the variable value:% MYSQL_HOME% \ bin
Or added directly in the path: D: \ MySQL \ bin
Note: The above is my own path, modify for their own path according to the situation
4. mysql registered as a windows service system
1) the use of the console in the administrator mode into the bin directory under the MySQL extract the directory:
2) Enter the service-installation command:
After a successful installation service will be prompted to install successfully.
mysqld install MySQL --defaults-file="D:\MySQL\my.ini"
#解压目录下修改的my.ini文件
After a successful installation service will be prompted to install successfully.
Note: my.ini file in the root directory of the MySQL decompression
remove service command: mysqld remove
5. Start MySQL service
First enter the initialization command mysqld --initialize-insecure --user = mysql
Method One:
Start Services command: net start mysql
Method Two:
Open the Services management tool, locate the MySQL service.
Start by selecting the right or click Start on the left to start the service.
6. Modify the root account password
When the installation is complete just the default root account password is blank, then you can modify the password for the specified password. Such as: 123456
c:>mysql –uroot -p
mysql>show databases;
mysql>use mysql;
mysql>UPDATE user SET password=PASSWORD("密码") WHERE user='root';
mysql>FLUSH PRIVILEGES;
mysql>QUIT
At this point MySQL installation is complete, enter cmd input mysql -u root -p Enter a password to use
ps: If the prompt "mysql are non-console command" to restart the computer