MySQL Community Server 8.0.12 installation and configuration method graphic tutorial

MySQL Community Server 8.0.12 installation and configuration method graphic tutorial

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:
  • MySQL 8.0.12 installation and configuration method graphic tutorial
  • mysql installer community 8.0.12.0 installation graphic tutorial
  • MySQL 8.0.12 winx64 detailed installation tutorial
  • MySQL 8.0.12 decompression version installation tutorial personal test!
  • MySQL 8.0.12 installation configuration method and password change
  • MySQL 8.0.12 installation and configuration method graphic tutorial (Windows version)
  • MySQL 8.0.12 decompression version installation tutorial
  • CentOS7 uses yum to install mysql 8.0.12
  • MySQL 8.0.12 installation and configuration method graphic tutorial (windows10)
  • MySQL 8.0.12 installation steps and basic usage tutorial under Windows

<<:  JavaScript method to detect the type of file

>>:  Docker advanced method of rapid expansion

Recommend

How to migrate mysql storage location to a new disk

1. Prepare a new disk and format it with the same...

Full steps to create a password generator using Node.js

Table of contents 1. Preparation 2. Writing comma...

Building a selenium distributed environment based on docker

1. Download the image docker pull selenium/hub do...

Share the problem of Ubuntu 19 not being able to install docker source

According to major websites and personal habits, ...

A brief discussion on the VUE uni-app life cycle

Table of contents 1. Application Lifecycle 2. Pag...

Vue.js implements music player

This article shares the specific code of Vue.js t...

Detailed explanation of the problem of CSS class names

The following CSS class names starting with a num...

About React Native unable to link to the simulator

React Native can develop iOS and Android native a...

MySQL installation and configuration method graphic tutorial (CentOS7)

1. System environment [root@localhost home]# cat ...

How to run Linux commands in the background

Normally, when you run a command in the terminal,...

What to do if you forget your password in MySQL 5.7.17

1. Add skip-grant-tables to the my.ini file and r...

MySQL insert json problem

MySQL 5.7.8 and later began to support a native J...

How to use nodejs to write a data table entity class generation tool for C#

Although Microsoft provides T4 templates, I find ...

Several ways to encapsulate axios in Vue

Table of contents Basic Edition Step 1: Configure...