MySQL 8 brings a brand new experience, such as support for NoSQL, JSON, etc., and has a performance improvement of more than twice that of MySQL 5.7. This article explains how to install MySQL 8 on Windows, as well as basic MySQL usage. download Download In this case: MySQL Community Server 8.0.12. Unzip Unzip it to the installation directory, such as the root directory of drive D. In this example: D:\mysql-8.0.12-winx64. Create my.ini my.ini is the configuration file for MySQL installation: [mysqld] # Installation directory basedir=D:\\mysql-8.0.12-winx64 #Data storage directory datadir=D:\\mysqlData\\data my.ini is placed in the root directory of the MySQL installation directory. It should be noted that the D:\mysqlData directory must be created first. The data directory is created by MySQL. Initial installation implement: mysqld --defaults-file=D:\mysql-8.0.12-winx64\my.ini --initialize --console The console output is as follows, indicating that the installation is successful: >mysqld --defaults-file=D:\mysql-8.0.12-winx64\my.ini --initialize --console 2018-08-20T16:14:45.287448Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server in progress as process 5012 2018-08-20T16:14:45.289628Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting. 2018-08-20T16:14:45.299329Z 0 [ERROR] [MY-010119] [Server] Aborting 2018-08-20T16:14:45.301316Z 0 [System] [MY-010910] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.12) MySQL Community Server - GPL. D:\mysql-8.0.12-winx64\bin>mysqld --defaults-file=D:\mysql-8.0.12-winx64\my.ini --initialize --console 2018-08-20T16:15:25.729771Z 0 [System] [MY-013169] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server in progress as process 18148 2018-08-20T16:15:43.569562Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: L-hk!rBuk9-. 2018-08-20T16:15:55.811470Z 0 [System] [MY-013170] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) initializing of server has completed Among them, "L-hk!rBuk9-." is the initialization password of the root user. Changes can be made later. Start and stop MySQL server Execute mysqld to start the MySQL server, or execute mysqld –console to see the complete startup information: >mysqld --console 2018-08-20T16:18:23.698153Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2018-08-20T16:18:23.698248Z 0 [System] [MY-010116] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe (mysqld 8.0.12) started as process 16304 2018-08-20T16:18:27.624422Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2018-08-20T16:18:27.793310Z 0 [System] [MY-010931] [Server] D:\mysql-8.0.12-winx64\bin\mysqld.exe: ready for connections. Version: '8.0.12' socket: '' port: 3306 MySQL Community Server - GPL. To shut down, execute mysqladmin -u root shutdown . Using the MySQL Client Use mysql to log in, the account is root, and the password is "L-hk!rBuk9-.": >mysql -u root -p Enter password: ************ Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 8.0.12 Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. Execute the following statement to change the password. "123456" is the new password. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.13 sec) MySQL common commands Display the existing databases: mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | |mysql | | performance_schema | |sys| +--------------------+ 4 rows in set (0.08 sec) Create a new database: mysql> CREATE DATABASE lite; Query OK, 1 row affected (0.19 sec) Using Database: mysql> USE lite; Database changed Create a table: Create a table and execute: mysql> CREATE TABLE t_user (user_id BIGINT NOT NULL, username VARCHAR(20)); Query OK, 0 rows affected (0.82 sec) View the table: View all tables in the database: mysql> SHOW TABLES; +----------------+ | Tables_in_lite | +----------------+ | t_user | +----------------+ 1 row in set (0.00 sec) View table details: mysql> DESCRIBE t_user; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | user_id | bigint(20) | NO | | NULL | | | username | varchar(20) | YES | | NULL | | +----------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) Insert data: mysql> INSERT INTO t_user(user_id, username) VALUES(1, '老卫'); Query OK, 1 row affected (0.08 sec) The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: JavaScript method to detect the type of file
>>: Docker advanced method of rapid expansion
1. Accessing literals and local variables is the ...
This article uses examples to describe the creati...
1. Alipay method: Alipay method: Click Alipay to ...
background When developing a feature similar to c...
Table of contents What is Docker Compose Requirem...
Preface This article mainly introduces the releva...
Table of contents 1- Error details 2-Single Solut...
You can see that their visual effects are very bea...
Source of the problem: If the slave server is the...
Preface When the code runs and an error occurs, w...
Openlayers is a modular, high-performance and fea...
Table of contents Preface Direct filling method f...
This article example shares the specific code of ...
Table of contents Preface question Online solutio...
This article shares a collection of Java problems...