Install mysql5.6 green without installation; install mysql5.6
I. Introduction to the installation version
MySQL is a small and exquisite but powerful database, which is very popular at present. However, the official website provides two installation packages: msi and zip. Many people found that there was no setup.exe in zipformat, and they were confused about how to install it in the face of a pile of files.
There are two types of MySQL installation files: msi and zip. If it is in the msi format, you can click Install directly and install it according to the installation prompt provided by it (I believe you can understand the English prompt). Generally, MySQL will be installed in C: \ Program Files \ MySQL Server 5.6 in this directory. the zip format is self-decompressed. After decompression, MySQL can be used, but configuration is required.
After decompression, You can rename the folder and place it in the appropriate location. I suggest you rename the folder to MySQL Server 5.6 and put it in the C: \ Program Files \ MySQL path. Of course, you can place it in any location you want.
II. Environment Variable Configuration
After completing the preceding steps, many users start to use MySQL, but the following figure shows an error. This is because no environment variable is configured.
It is easy to configure environment variables:
My computer-> properties-> advanced-> Environment Variables
Select PATH and add the PATH to your mysql bin folder (for example, C: \ Program Files \ MySQL Server 5.6 \ bin)
PATH =...; C: \ Program Files \ MySQL Server 5.6 \ bin (Note: append, Not Overwrite)
3. modify the configuration file
After the environment variables are configured, do not start mysql. We also need to modify the configuration file (if no configuration is available, the file will appear at startup: Error 2 the system cannot find the file ), the default profile for the mysql-5.6.1X is in C: \ Program Files \ MySQL Server 5.6 \ my-default.ini, or create a my. INI file,
Modify or add configuration () in it ():
[Mysqld]
Basedir = C: \ Program Files \ MySQL Server 5.6 (mysql directory)
Datadir = C: \ Program Files \ MySQL Server 5.6 \ data (mysql directory \ data)
NOTE: If some friends find that there is no data folder under their installation package, or the following error occurs when mysql starts the service
Mysql service cannot be started
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
These may be caused by the absence or problems of data files. Do not copy other data files:
Delete the original data file and open the cmd window as an administrator (you must run it as an administrator, or you have insufficient permissions ):
Enter cd C: \ Program Files \ MySQL Server 5.6 \ bin to enter the mysql bin folder.
Then enter the command: mysqld -- initialize-insecure -- user = mysql and press enter to view the data folder in the directory. Solve the problem! How to open the cmd window as an administrator: Enter the Directory: C: \ Windows \ System32 find the cmd.exe file-> right-click-> run as an administrator
4. Install the database
1. Run cmd as an administrator (Be sure to run it as an administrator; otherwise, the permissions are insufficient ),
Enter cd C: \ Program Files \ MySQL Server 5.6 \ bin to enter the mysql bin folder (whether or not environment variables are configured, enter the bin folder, otherwise, an error will still be reported when the service is started. 2)
Enter mysqld-install (if you do not need to run it as an administrator, the following error will occur due to insufficient permissions: Install/Remove of the Service Denied !)
Installed successfully
2. After the installation is successful, start the service. In cmd, enter net start mysql (). The service starts successfully!
3. After the service is successfully started, you can log on. Enter mysql-u root-p (no password for the first login, press Enter!
4. Use Mysql visualization tools to use and manage databases.
5. How to manually enable and stop the mysql Service
Right-click the computer icon and choose manage.
Find the Mysql service in the service and right-click it to enable and terminate it.