Mysql download and installation

download

Open: https://www.mysql.com/downloads/   

1. Click the item: ,

2. After entering, click:

3. Go to the real download page, select the platform, select the version (installation version and free installation version), download

4. I now download the free version of " Windows (x86, 64-bit), ZIP Archive "

 

install service

1. Download MySQL

 

2. Unzip
    the MySQL zip package. Unzip the downloaded MySQL zip package to a custom directory. My unzip directory is:
    "D:\java\mysql".
    Copy the default file my-default.ini in the unzip directory and rename it. my.ini
    Copy the following configuration information to my.ini and save #If
    there is no my-default.ini, you can create a new my.ini by yourself
###################### ###################################
  [client]
  port=3306
  default-character-set=utf8
  [mysqld ]
  port=3306
  character_set_server=utf8 #Installation
  path
  basedir=D:\java\mysql #Data
  path
   datadir=D:\java\mysql\data
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
    [WinMySQLAdmin]
   Server=D:\java\mysql\bin\ mysqld.exe
############################################### ##########

 

3. Add environment variables (optional)

    The operation is as follows:
    1) Right-click My Computer -> Properties -> Advanced System Settings (Advanced) -> Environment Variables
      Click the New button under System Variables to
      enter the variable name: MYSQL_HOME
      Enter the variable value: D:\java\mysql
      #ie Custom unzip directory for mysql.
    2) Select Path in the system variable and
      click the edit button
      to add the variable value to the variable value: %MYSQL_HOME%\bin
      Note that this variable is added after the original variable value, separated by;, the original variable value cannot be deleted,

 

4. Register mysql as a windows system service

    1) Go to the bin directory under the MySQL decompression directory from the console:
    2) Enter the service installation command:
    mysqld install MySQL --defaults-file="D:\java\mysql\my.ini" #modified
    in the decompression directory After the my.ini file is
    installed successfully, it will prompt that the service is installed successfully.
    #Note: the my.ini file is placed in the root directory of the decompressed MySQL #Remove
    service command: mysqld remove

 

5. Start the MySQL service

    Method 1:
        Start the service command: net start mysql
    Method 2:
        Open the management tool service and find the MySQL service.
        Start the service by right-clicking and selecting Start or by clicking Start on the left.

If the error message here is: The MySQL service on the local computer starts and stops. Some services stop automatically when not being used by other services or programs

Solution: first enter the initialization command to execute mysqld --initialize-insecure --user=mysql

Then install the service, as shown in the figure

 

6. Modify the password of the root account

    When the installation is completed, the default password of the root account is empty. At this time, you can change the password to the specified password. Such as: 123456
    c:>mysql –uroot
    mysql>show databases;
    mysql>use mysql;
    mysql>UPDATE user SET password=PASSWORD("123456") WHERE user='root';
    mysql>FLUSH PRIVILEGES;
    mysql>QUIT
 

The newly installed MySQL 5.7, enter UPDATE user SET password=PASSWORD("123456") WHERE user='root'; When prompted ERROR 1054 (42S22): Unknown column 'password' in 'field list', it turned out to be under the mysql database There is no password field, the password field is changed to authentication_string, so UPDATE user SET authentication_string=PASSWORD("123456") WHERE user='root';


7. MySQL console shortcut creation:
    1) Right-click on the desktop -> New -> Shortcut -> Object location input: C:\Windows\System32\cmd.exe
        Define the shortcut name by yourself, OK, the shortcut is successfully created
    2) Right-click the shortcut you just created -> Properties -> Change the target column to MySQL startup parameters:
        C:\Windows\System32\cmd.exe "D:\Program Files\MySQL\mysql-5.6.13-win32\ bin" /k mysql -uroot -p inventory
        explanation: CMD path "MySQL path bin directory" /k mysql -u username -p password database name
    3) After the modification is completed, click OK to save, and double-click the shortcut to connect to MySQL database


8. MySQL related commands

  msyqld --remove //Close the service
      mysqld -install //Start the service
      net start mysql //Start
      mysqlshow -u root mysql //You can view the table
mysql -u root -p //You can log in as root

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326073585&siteId=291194637