Detailed tutorial on installing mysql server locally
Download address: https://dev.mysql.com/downloads/mysql/ After the
download is successful, decompress it locally. After decompression,
configure the environment variables as follows , advanced system settings -> system properties -> advanced -> environment variables -> system variables -->Add under path:
D:\Mysql\mysql-8.0.22-winx64
D:\Mysql\mysql-8.0.22-winx64\bin
Then start running mysql: it is also whether our server can run The key
note: see if there is a my.ini file and a data file in the directory where we decompressed :
If you don’t have a my.ini file to create it manually, remember not to create the data file manually. If you create it manually, delete the
content:
[mysql]
default-character-set=utf8
[mysqlId]
#端口设置
port=3306
#设置mysql的安装目录
basedir ="D:\Mysql\mysql-8.0.22-winx64"
#设置mysql的数据存放目录
datadir ="D:\Mysql\mysql-8.0.22-winx64\data"
#允许最大连接数
max_connections=30
#服务端使用的字符集默认为8比特编码的Latin1字符集
character-set-server=utf-8
#创建新表是将使用的默认存储引擎
default-storage-engine-INNODB
Open the cmd window as an administrator:
if there is no data file, execute the command:
mysqld --initialize-insecure --user=mysql
After the data file is created, start mysql:
mysqld --install
After executing the command, service successfully installed will appear, indicating that mysql is installed successfully.
Start mysql
net start mysql
Log in to mysql after successful startup:
mysql -uroot -p
There is no password for the first login. Enter password: Just press Enter.
Successful login:
My mysql version is 8.0.22. The command to modify the login password is as follows
#首先选中mysql库:
use mysql;
#修改user 表中用户为root的密码:
alter user 'root'@'localhost' IDENTIFIED BY 'new password';
OK! The installation of our mysql server is over;
I hope it will be useful to you, please leave a message if you have any questions. Please indicate the source of reprinted plagiarism, so that we can grow together.
Supplementary knowledge:
#查看mysql的服务:
sc query mysql
#删除mysql命令:
sc delete mysql
#停止mysql服务
net stop mysql