Installation Configuration and Uninstallation of MySQL 8.0 in Windows Environment
- 2021-12-13 09:54:01
- OfStack
Software version
Windows: Windows10 MySQL: mysql-8. 0.17-winx64. zipInstallation steps
1. Configure environment variables
name : Path
value : C:\Program Files\MySQL\mysql-8.0.17-winx64\bin
2. Create a new my. ini file
File location: C:\ Program Files\ MySQL\ mysql-8. 0.17-winx64\ my.ini
(This is my installation directory. You can modify it according to your actual installation path.)
[mysqld]
# Port number (default: 3306 )
port=3306
# Settings mysql Installation directory of
basedir=C:\Program Files\MySQL\mysql-8.0.17-winx64
# Settings mysql The storage directory of the data in the database
datadir=C:\Program Files\MySQL\mysql-8.0.17-winx64\data
# Maximum number of connections allowed
max_connections=1000
# Maximum wait time (non-interactive connection: jdbc Connect to the database)
wait_timeout=60
# Maximum wait time (interactive connection: mysql Client)
interactive_timeout=600
# Set the default time zone
default-time_zone='+8:00'
The default port of mysql-8. 0 is 3306, and the code is utf8mb4, so there is no need to set it again
3. Run the command prompt as an administrator
// 1 , initialize MySQL Database
C:\Program Files\MySQL\mysql-8.0.17-winx64\bin> mysqld --initialize --console
// If it appears " initializing of server has completed ", or data If many files are generated under the folder, the initialization is successful
// It will be displayed on the console here 1 Random passwords, in root@localhost: After
// 2 , installation MySQL Services
C:\Program Files\MySQL\mysql-8.0.17-winx64\bin> mysqld install
// If the default service name is not used, enter mysqld install mysql8.0 Specifying that the service name is mysql8.0
// If it appears " Service successfully installed. " Or the service has MySQL This service means that the installation is successful
// 3 , start MySQL Services
C:\Program Files\MySQL\mysql-8.0.17-winx64\bin> net start mysql
// Object for the specified service name mysql : net start mysql8.0
// 4 At this point, the installation is finished. You can log in and try it. The password is the random password generated when initializing the database
C:\Program Files\MySQL\mysql-8.0.17-winx64\bin> mysql -uroot -p
// Object for the specified port mysql : mysql -uroot -P3305 -p
// 5 , modification root Password
mysql> alter user 'root'@'localhost' identified by 'root';
Uninstall tutorials
1. Run the command prompt as an administrator
// 1 , stop MySQL
D:\ProgramFiles\MySQL\mysql-8.0.16-winx64\bin> net stop mysql
// Object for the specified service name mysql : net stop mysql8.0
// 2 , uninstall MySQL
D:\ProgramFiles\MySQL\mysql-8.0.16-winx64\bin> mysqld remove
// Object for the specified service name mysql : mysqld remove mysql8.0
2. Open the registry: run- > regedit, delete the following directories
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Eventlog\Application\MySQL
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Applications/MySQL
Errors and Solutions
1. Error: Install/Remove of the Service Denied!
Solution: Run the command line as an administrator
Summarize