Os:windows 10 Home Chinese version mysql:mysql-5.7.20-winx64.zip
Ben.z
Reference Links:
Installing MySQL on Microsoft Windows
Installing MySQL on Microsoft Windows Using a noinstall ZIP Archive
Let's talk about my history of installing MySQL:
The first is installed with the Windows executable file, after installation, use the MySQL notifier to turn off the service;
Later, learned to install the installation-free version (Noinstall), download the package, Baidu search "How to install the free version of MySQL", and then according to others to write
Install MySQL in Chinese, then use NET command to start or stop the service or set the service in the service controller.
This is also free installation version, but the difference is that no Baidu to find information, but according to the MySQL official website (English) installation steps to install the MySQL, finally, MySQL installation
succeeded and set the MySQL server to a random start-stop (starting MySQL as a Windows service).
The installation steps are as follows:
-Download MySQL free install version
A zip file that I downloaded is mysql-5.7.20-winx64.zip;
-Unzip the free install version and place the extracted folder in your designated location
The extracted folder is the home directory of MySQL, change the folder name to MySQL (everyone arbitrarily), and then placed in their designated location-my is d:\p
-Open the Readme in the MySQL directory to find the installation instructions
Check the Readme file to find out how to install MySQL data, and then open the appropriate installation instructions (for installation instructions ... ) gradually install MySQL;
-Open web 2.3.5, then follow the steps inside to install the MySQL free install version, and finally set up the MySQL service as a Windows service
As can be seen, the MySQL website gives 9 steps, among them, 2.3.5.2, 2.3.5.4 is the key, the following describes the installation process of the key steps;
-2.3.5.2 Creating an Option File
This section describes creating a MySQL configuration file: When MySQL starts, the MySQL server is set according to the contents of this profile.
The Web page says that MySQL will look for a configuration file in two places when it starts: The Windows directory, the MySQL installation directory.
Where the WINDOWS directory is generally "C:\WINDOWS", the command line using echo%windir% can be found, the MySQL installation directory is the front of our
Extract the resulting directory.
The name of the configuration file is My.ini or my.cnf, however, the My.ini priority is higher than my.cnf, which is a text file.
The essential! The configuration of these two two-name files where the configuration files are placed will be read out to configure MySQL, in order to avoid confusion, please put all
Write to a file and place it in a directory.
I wrote the configuration information into the My.ini file and put it in the MySQL installation directory.
Next, enter the content in the option file. In this page, there are two configuration items that need to be entered:Basedir, DataDir, basedir for MySQL installation
DataDir represents the data storage directory for the MySQL database.
Note that the path delimiter for Windows is "Slash", you need to replace it with "backslash ", or each slash is replaced with two slashes.
note that the data directory needs to be created manually, I was in the MySQL installation directory created by the Data folder, empty.
Question: Do you want to create an option file? Not set up a line? Can basedir or DataDir not be set?
My configuration file is as follows:
For more configuration options, see the Server configuration defaults and the links page.
-initializing the Data Directory
The location of the data folder is specified in the configuration file DataDir, but the new data folder is empty and needs to be initialized at this point.
MySQL Official guide: 2.9.1.1 Initializing the Data Directory manually Using mysqld
Note that Windows Administrator permissions are required to perform this operation.
Open the Windows command-line tool with administrator privileges and enter the MySQL installation directory;
Two commands were given in the official guidance 2.9.1.1:--initialization 、--initialization-insecure, literally, the former security, the latter one is unsafe.
The--initialization command initializes a random password to the ' root ' @ ' localhost ' account, and the--initialization-insecure command creates a ' root ' @ ' localhost ' account
Blank password, and will not expire ( originally I installed the mysql is insecure ah! ).
I choose--initialization Command , execution method and result:
When execution is complete, no results are displayed on the command line.
However, a lot of folders and files have been created in the data directory at this time.
Just said, using--initialization will give the ' root ' @ ' localhost ' account to create a random password, then, where is this random password? Did you see it? It's inside.
A file ending with. Err , this random password is in here, and after the server is started, you can use the root account and this password to log in;
At this point, the data file initialization is complete.
In the official guidance document, there are more initialization commands to choose from, such as--user 、--defaults-file 、--Console ...
-Start MySQL server for the first time
After the previous configuration file is written and the data directory is initialized , the MySQL server can be started.
The various commands for MySQL are found in the Bin directory under the installation directory: MySQL, mysqld, mysqldump, mysqladmin ... (I have used)
This section of the start MySQL server is to use the MYSQLD command, execute the following command to start:
Mysqld.exe--console
However,--console can not use it to see the log messages directly on the command line.
The default port for MySQL is 3306, as you can see, the MySQL server is up and ready to accept the connection.
After the MySQL server is started, you can see it in the Windows Task Manager:
note that the Windows Security Alert serial port appears when you start the MySQL server, and click the "Allow Access" button.
note that during MySQL runtime, error logging occurs, and these error log records are stored in a file that ends in *.err in the data directory, and of course, the file that logs the error log
You can also set the MYSQLD command when the server is started, and the settings execute as--log-error.
When starting the server with the MYSQLD command, you can also enter the following directives:
--standalone
--debug
--shared-memory (need more in-depth understanding)
All of the options supported by the MYSQLD command can be output via the following command ( note that the content is super-many and can be output to a file):
Mysqld--verbose--help
Verbose:adj., lengthy, wordy
MySQL server shutdown mode: Use the mysqladmin command
Mysqladmin- u root shutdown
However, I am using CTRL + C to stop the server from running.
-Connect a running MySQL server
This article uses the MySQL command to connect to it from the Windows command line.
Open the Windows command line, go to the MySQL installation directory, and use the Mysql.exe command in the bin directory to connect to the running server.
Enter the following command:
Bin\mysql.exe-uroot-p
Enter the root password to log on to the server.
As I said earlier, the root password is what is described earlier in this article.
Use show databases; command to view the database in the server: failed! Force the password to change the root account!
After the modification, then use show databases, you can see the current list of databases, only 4 databases exist, each has what use, need to be introduced separately.
View the database server's account information: in the user table of the MySQL database, there are only 3 accounts initialized, Root is one of them, and the other two are useless.
MySQL more operation, command how to use, please see each of the relevant tutorials!
-Add the MySQL action command to the Windows environment variable path
In the previous use of MySQL command, we need to enter the path of the command, so it is inconvenient to enter the MySQL bin directory from the command line!
In order to be able to use commands directly in the command-line tool, the MySQL bin directory is added to the Windows environment variable PAH.
note that the environment variable path in My computer is path.
note that different Windows operating systems add windows that are not the same as Windows 10.
After the MySQL command is added to the environment variable path, it can be tested and I am successful this time.
At the end of the official guidance, if more than one MySQL is installed on the computer, it is not recommended to add the MySQL command to path, nor to add it to avoid conflicts.
Of course, such a computer must be the programmer's computer, the development of the computer.
-Install the MySQL server as a Windows service and start randomly
This is the last step of this article.
Official guide: 2.3.5.8 starting MySQL as a Windows Service
The official guidance is very clear, now I use my way of presentation.
MySQL is installed as a Windows service so that it can be started randomly, and can also be managed using the command net or graphical tool service Manager.
note that the next operation requires a Windows command line opened with an administrator.
Note that you should stop the MySQL server before setting it up.
To perform this step, you need to use the MYSQLD command to open the command line as an administrator and enter the Mysqld-install command to complete the installation;
After the installation is complete, you can see MySQL under the Windows Service Manager, the Startup type is "Automatic" and the status is empty-stop.
Automatically means that the MySQL server will start after Windows is powered on, without manual action.
Now, start the MySQL server. Two ways: NET command, startup in Windows Service Manager. The net command mode is displayed.
Start successfully, you can see in the service manager that the status of the MySQL service is "running", you can also connect it through the client;
At this point, the MySQL server installation is complete, please use it! Please use Python to connect to test development!
In the official guide, installing MySQL for Windows Services can also add additional parameters, such as--install specifying the server name 、--defaults-file 、--Local-service, and so on.
The default name for the MySQL service installed with--install is MySQL, which can be modified.
The specific meaning of the parameter can be seen in the official guidance document.
In addition, the MySQL service installed with the--install parameter is started randomly, or it can be installed as a manual startup using the --install-manual parameter.
Other:
Just installed MySQL folder size has nearly 2GB, of which, the Lib directory mysqlserver.dll more than 1GB:
Testimonials: Hey
This time according to the official instructions to install MySQL harvest is still a lot of, before reference some Chinese information installation, always feel not steadfast, this time, many doubts are lifted, feel oneself again can!
Install MySQL using the install-free package