MySQL installation and connection

1. Install

Download: https://dev.mysql.com/downloads/mysql/

Common Problems and Solutions: https://blog.csdn.net/chen97_08/article/details/81484286

1.1. Adding Environment Variables

The mysql-5.7.21-winx64 after extracting \ bin to the system path environment variable.

Open My Computer - right-click the blank space - Properties - Advanced System Settings - Advanced - Environment Variables - double-click Path, New, copy the above path.

1.2. Initialization

Run as administrator cmd: mysqld --initialize-insecure

Under win10 environment are an administrator, open cmd, mysql version 5.7.27

2.MySQL start, connected to closed
2.1 Starting MySQL from the Windows Command Line
PS C:\WINDOWS\system32> mysqld
#此时可以开启客户端进行连接
Stop MySQL Server 2.2
PS C:\WINDOWS\system32> mysqladmin -u root shutdown
#如果MySQL root用户账户有密码,你需要调用命令mysqladmin -u root -p shutdown并根据提示输入密码。
2.3 Starting MySQL as a Windows Service

2.3.1 Installing the server

PS C:\WINDOWS\system32> mysqld --install
Service successfully installed.

2.3.2 MySQL open service

PS C:\WINDOWS\system32> net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
#此时可以开启客户端进行连接

2.3.3 shut down MySQL service

PS C:\WINDOWS\system32>  net stop mysql
MySQL 服务正在停止.
MySQL 服务已成功停止。

2.3.4 uninstall the server

PS C:\WINDOWS\system32> mysqld --remove
Service successfully removed.
2.4 open client, server connection
............先开启服务端...........
PS C:\WINDOWS\system32> mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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.

mysql>
#此时可以进行数据库操作,输入exit,回车可退出

Guess you like

Origin www.cnblogs.com/notfind/p/11371396.html