mysql压缩包安装配置

1.在环境变量中添加:MYSQL_HOME:C:5_studymysql-5.7.10-winx64,在path路径中加入:%MYSQL_HOME%in。配置环境变量不是必须的,只是为了能更方便的在命令行中使用mysql的命令行工具。

2.修改my.ini配置文件

将my-default.ini拷贝一份,重命名为my.ini 内容要包含如下部分:

[mysqld]

loose-default-character-set=utf8

basedir="C:/05_study/mysql-5.7.10-winx64"

datadir="C:/05_study/mysql-5.7.10-winx64/data"

[client]

loose-default-character-set=utf8

[WinMySQLadmin]

Server=C:/05_study/mysql-5.7.10-winx64/bin/mysqld.exe

character-set-server=utf8

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

3.注意,不要自已手动去建C:/05_study/mysql-5.7.10-winx64/data文件夹。

4.安装服务

开始——所有程序——附件——命令提示符,右键以管理员身份运行。 输入命令:

C:5_studymysql-5.7.10-winx64in>mysqld --initialize-insecure --user=mysql

C:5_studymysql-5.7.10-winx64in>

C:5_studymysql-5.7.10-winx64in>mysqld -install

Service successfully installed.

C:5_studymysql-5.7.10-winx64in>net start mysql

The MySQL service is starting.

The MySQL service was started successfully.

C:5_studymysql-5.7.10-winx64in>

 在命令行启动mysql命令为: net start mysql      关闭mysql命令为:net stop mysql

如果要重装,先停掉mysql,再mysqld -remove 就可以卸载掉.

5.登录mysql,修改root用户密码为什123456

C:5_studymysql-5.7.10-winx64in>mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or g. Your MySQL connection id is 2 Server version: 5.7.10 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)

mysql>use mysql

mysql>

mysql> update user set authentication_string=password('123456') where user='root ' and Host='localhost';

Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1  Changed: 1  Warnings: 1

mysql>

mysql> flush privileges;

mysql> quit

6.远程登录配置 

允许root用户在任何地方进行远程登录,并具有所有库任何操作权限,具体操作如下:

1)在本机先使用root用户登录mysql:

命令行执行:mysql -u root -p

输入密码(第7步中设置的密码):123456

2)进行授权操作:

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;

重载授权表:

mysql>FLUSH PRIVILEGES;

退出mysql:quit

原文地址:https://www.cnblogs.com/blogzhangwei/p/5949868.html