MySQL detailed installation tutorial

MySQL detailed installation tutorial

1. Quguan network download mysql

The own system (32-bit or 64-bit) to select the appropriate version. Download Link: https://dev.mysql.com/downloads/mysql/

2. After downloading decompress compressed, decompressed file as shown below:

Note: Different versions of mysql after extracting files may differ slightly, but do not care, then down.

3. Configure environment variables (important)

Add the path to the MySQL extract the bin directory is located in the Path environment variable.

Specific process: Open My Computer, click Computer Properties, Advanced system settings, environment variables, variables in the system variable to find the path inside, click Edit to add into the MySQL bin directory after decompression,

For example, I is C: \ Program Files \ MySQL \ MySQL Server 5.7 \ bin, because the path variable has a lot of value, it's time to add to add a new path in front of the semicolon that should be; C: \ Program Files \ MySQL \ MySQL Server 5.7 \ bin, and then point has been determined, thus environment variables configured. Remember do not move the original things inside.

4. Run the command prompt as an administrator.

Mouse over the lower left corner windows icon, right-click and select the command prompt (administrator) can be, will enter the DOS interface.

Enter C: (because my MySQL installed in C drive, so that C)

Enter in MySQL bin directory, enter the following statement

cd   C:\Program Files\MySQL\MySQL Server 5.7\bin

NOTE: The above directory must own and directories on the same computer.

5. Install MySQL

Enter the following statement

mysqld --initialize

Then press Enter, you may need to wait a few seconds, and then generates a data folder in the root directory of MySQL.

Continue entering

mysqld -install

如果出现Service successfully installed,则说明已经安装成功。但是,还没有结束。。。。。。

6.修改配置文件

如果MySQL安装目录下有一个my-default.ini文件,将它改名为my.ini,如果没有,直接新建一个my.txt文本文档,在里面复制粘贴如下内容

[mysqld]  
port = 3306  
basedir=E:/Mysql/mysql-5.7.21-winx64  
datadir=E:/Mysql/mysql-5.7.21-winx64/data   
max_connections=200  
character-set-server=utf8  
default-storage-engine=INNODB  
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES  
[mysql]  
default-character-set=utf8

注意:basedir后面加的是MySQL的安装路径,而datadir后面加的是data文件夹的安装路径。

然后关闭记事本保存,将txt后缀改为ini

7.继续在刚才的命令提示符中输入

net start mysql

如果提示服务启动成功,则马上就要大功告成,

如果提示不是内部或外部命令,也不是可运行或批处理程序, 我的电脑->右键->属性->高级->环境变量->系统变量->path,再点“编辑”就可以了。在“变量值”对话框里面加“C:\windows\system32“,这是cmd.exe存在的路径,然后点确定就可以了。

8.继续在刚才的命令提示符中输入

net stop mysql

9.以记事本方式打开mysql目录下的my.ini文件,在[mysqld]下面添加语句skip-grant-tables,保存后关闭。

10.继续在命令提示符中输入mysql登录命令

mysql -uroot -p  然后继续按回车

11.修改root密码

update user set authentication_string=password('新密码') where user='root'; 

注意句末的分号,密码可以设置为空,然后输入flush privileges刷新权限,然后输入exit退出

12.重新打开my.ini文件,将刚才添加进去的skip -grant-tables语句删除,保存后退出,重启mysql服务。

13.打开命令提示符,输入

mysql -uroot -p

然后输入密码,大功告成!

 

Guess you like

Origin www.cnblogs.com/changanshisanzhao/p/11322142.html