MYSQL installation and configuration (Windows)

Installing MySQL on Windows

Install MySQL on Windows will be relatively simple, the latest version is available in MySQL download download view (more detailed installation: the installation of MySQL on Windows ).

picture

2

Click the Download button to go to the download page, click on the figure below No thanks, just start my download download immediately:
3

Once downloaded, we will extract the zip package to the appropriate directory where the file after I unzip the folder on the C: \ web under \ mysql-8.0.11.

Next we need to configure the MySQL configuration file under

Open just unzip the folder C: \ web \ mysql-8.0.11, create a my.ini configuration file in the folder, edit my.ini configure the following basic information:

[client]
# 设置mysql客户端默认字符集
default-character-set=utf8
 
[mysqld]
# 设置3306端口
port = 3306
# 设置mysql的安装目录
basedir=C:\\web\\mysql-8.0.11
# 设置 mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置,系统自己生成即可,否则有可能报错
# datadir=C:\\web\\sqldata
# 允许最大连接数
max_connections=20
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB

Next we start the next MySQL database:

Administrator cmd to open a command line tool, change directory:

cd C:\web\mysql-8.0.11\bin
Initialize the database:

mysqld --initialize --console
After the execution is complete, the output initial root user's default password, such as:

...
2018-04-20T02:35:05.464644Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: APWCY5ws&hjQ
...

APWCY5ws&hjQ Is the initial password, subsequent logins need to use, you can also change the password upon login.

Enter the following command to install:

mysqld install
Start by entering the following command:
net start mysql

Note: In 5.7 you need to initialize data directory:

cd C:\web\mysql-8.0.11\bin 
mysqld --initialize-insecure 

Initialize then run net start mysqlto start mysql.

Log in MySQL

When the MySQL server has been running, we can log in through the built-in MySQL client tools to the MySQL database, first open a command prompt, enter the following naming format:
mysql -h 主机名 -u 用户名 -p

参数说明:

-h : 指定客户端所要登录的 MySQL 主机名, 登录本机(localhost 或 127.0.0.1)该参数可以省略;
-u : 登录的用户名;
-p : 告诉服务器将会使用一个密码来登录, 如果所要登录的用户名密码为空, 可以忽略此选项。

If we want to log MySQL database of the machine, only need to enter the following command:
mysql -u root -p
confirm press Enter, if installed correctly and MySQL is running, you get the following response:
Enter password:
If there is a password, enter the password, then press back does not exist Cart Login. After a successful login you will see Welcome to the MySQL monitor...the prompt.

Then the command prompt would have been to mysq>add a blinking cursor waiting for input commands, input exitor quitLog.

Guess you like

Origin www.cnblogs.com/Weber-security/p/12654257.html
Recommended