MySQL Community Server Installation
Download: https://dev.mysql.com/downloads/mysql/ , ZIP installation, after decompression in fact it can be used, but should be configured.
1 unzip unzip the file into the D drive: D: \ mysql \ mysql-8.0.17-winx64, created my.ini file in the same folder, configure the following information. The D: \ mysql \ mysql-8.0.17-winx64 \ bin folder to facilitate future system environment variables call.
[client]
# 设置mysql客户端连接服务端时默认使用的端口
port=3306
# 设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
# 设置3306端口
port=3306
# 设置mysql的安装目录
basedir=D:\mysql\mysql-8.0.17-winx64
# 设置mysql数据库的数据的存放目录,MySQL 8+ 不需要以下配置
# datadir=D:\mysql\mysql-8.0.17-winx64\data
# 允许最大连接数
max_connections=20
# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统
max_connect_errors=10
# 服务端使用的字符集默认为UTF8
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
# 默认使用“mysql_native_password”插件认证
default_authentication_plugin=mysql_native_password
[mysql]
# 设置mysql客户端默认字符集
default-character-set=utf8
2, run cmd, use the command mysqld --initialize --console, initialize the database, it will output the initial root user's default password to log back needed
3, installation services, use the command mysqld --install [service name] , must cd to the bin folder for installation, service name, the default case for the need to distinguish between mysql, mysql service on multiple computers
4, start, use the command net start mysql
5, log, mysql -h hostname -u user name -p, log in to this machine use: MySQL -u root -p , and enter the front of the temporary password
- -h: mysql hostname specified client login, log in to this machine may be omitted or use localhost or 127.0.0.1
- -u: username login
- -p: Use password, if the password is blank, omit this
6, modify the password, use the command ALTER USER 'root' @ 'localhost ' IDENTIFIED WITH mysql_native_password BY ' password';
Note that there must be a semicolon, SQL syntax
-------------------------------------------------- ----- deployed here ended --------------------------------------- -----------
7, view the default installation database using the command Show Databases; use mysql; Show the Tables , where the user mysql table which stores user information, view the default user: the SELECT user, host, authentication_string from user; administrator root of the host is localhost, on behalf of only localhost login access. If you want to allow open other ip login, you need to add a new host. If you want to allow all ip access can modify directly into the "%."
8, adding users CREATE USER 'username' @ '%' IDENTIFIED WITH mysql_native_password BY ' password';
Check user select user, host, plugin, authentication_string from user;
9, authorized remote database
All authorization rights . GRANT ALL PRIVILEGES ON * * TO ' username' @ '%';
Authorized basic queries to modify permissions . GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON * * TO ' username' @ '%';
View user permissions show grants for 'user name' @ '%';
MySQL Client executable program is mysql, MySQL Server executable program is mysqld.
Other commands:
Start Service net start mysql, stop the service net stop mysql, uninstall the service sc delete mysql or mysqld remove
Exit MySQL Exit