您的位置:首页 > 数据库 > MySQL

Install MySQL 5.7 Enterprise Server in 10 minutes

2016-04-22 11:09 477 查看
# Download the enterprise/commercial version of MySQL (zip installer) from official site.

# Extract it to C:/mysql

# Make a default config file C:/my.ini containing the following content:

[mysqld]

basedir=C:/mysql

datadir=C:/mysql/data

max_connections=500

# Create the data directory i.e C:/mysql/data

# Initialize the data directtory:

C:/mysql/bin/mysqld --defaults-file=C:/my.ini --initialize --console

# Try to start the server:

C:/mysql/bin/mysqld --console

It will create a random password for the user 'root'@'localhost', record it.

# Now we must change the temporary password:

C:/mysql/bin/mysql -u root -p

enter the random password, then

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

mysql> exit

# Shutdown the server:

C:/mysql/bin/mysqladmin -u root -p shutdown

# Install mysqld as a Windows service:

C:/mysql/bin/mysqld --install

# Go to Control Panel - Administration Tools - services, start the service MySQL

# Start the client to create databases and users:

C:/mysql/bin/mysql -u root -p

mysql> create database db1

mysql> create database db2

mysql> create user 'user1'@'localhost' identified by 'User@123';

mysql> create user 'user1'@'%' identified by 'User@123';

mysql> grant all privileges on *.* to 'user1'@'localhost' with grant option;

mysql> grant all privileges on *.* to 'user1'@'%' with grant option;

mysql> exit

# You are all set to connect to "jdbc:mysql://myhost:3306/db1?jdbcCompliantTruncation=false" with the user user1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: