标签:ora ade roc article root 图片 64位 details nta
win7 64位
IP地址:192.168.2.37
防火墙已经关闭
1、解压文件
2、新建my.ini文件
data文件夹自动生成
my.ini里面内容为:
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=E:\mysql-5.7.14-winx64 # 设置mysql数据库的数据的存放目录 datadir=E:\mysql-5.7.14-winx64\data # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB
3、配置环境变量,避免每次都要到安装目录下的bin里面执行。
4、初始化数据、安装服务、启动MySQL
以管理员的身份运行cmd,将目录切换到你mysql安装目录的bin目录
mysqld --initialize-insecure
执行 mysqld --initialize-insecure 指令进行配置,安装路径会默认生成一个data文件夹
mysqld --install mysql5.6
net start mysql5.6
E:\mysql-5.7.14-winx64\bin>mysqld --initialize-insecure E:\mysql-5.7.14-winx64\bin>mysqld --install Service successfully installed. E:\mysql-5.7.14-winx64\bin>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。
5、用户设置
cmd到bin目录下执行mysql -uroot (无需密码) , 即可进入,因为上边是用insecure 创建的
创建一个root用户,并设置密码
MariaDB [aa]> grant all on *.* to root@‘%‘ identified by ‘123456‘;
客户端连接成功
1、解压文件
2、新建my.ini文件
my.ini里面内容如下:
[mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3307端口 port = 3307 # 设置mysql的安装目录 basedir=E:\mysql-5.6.32-winx64 # 设置mysql数据库的数据的存放目录 datadir=E:\mysql-5.6.32-winx64\data # 允许最大连接数 max_connections=200 # 服务端使用的字符集默认为8比特编码的latin1字符集 character-set-server=utf8 # 创建新表时将使用的默认存储引擎 default-storage-engine=INNODB
3、初始化数据、安装服务、启动MySQL
mysqld --initialize-insecure
mysqld --install mysql5.6
net start mysql5.6
E:\mysql-5.6.32-winx64\bin>mysqld --initialize-insecure 2019-05-23 16:07:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is depreca ted. Please use --explicit_defaults_for_timestamp server option (see documentati on for more details). 2019-05-23 16:07:54 0 [Note] mysqld (mysqld 5.6.32) starting as process 2492 ... E:\mysql-5.6.32-winx64\bin>mysqld --install mysql5.6 Service successfully installed. E:\mysql-5.6.32-winx64\bin>net start mysql5.6 mysql5.6 服务正在启动 . mysql5.6 服务已经启动成功。
服务启动成功之后,就可以登录了,如图,输入mysql -u root -p(第一次登录没有密码,直接按回车过),登录成功!
E:\mysql-5.6.32-winx64\bin>mysql -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.7.14 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec)
4、设置root密码
注意:
mysql> update user
set
password=password(“新密码”) where user=”用户名”;
执行后报错:ERROR 1054 (42S22): Unknown column ‘password‘ in ‘field list‘
错误的原因是 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
mysql> update mysql.user set authentication_string=password(‘123456‘) where user=‘root‘ and host=‘localhost‘;
刷新内存生效
mysql> flush privileges;
mysql> update mysql.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> flush privileges; Query OK, 0 rows affected (0.01 sec)
查看所有用户信息
mysql> select user,host from mysql.user;
mysql> select user,host from mysql.user; +-----------+-----------+ | user | host | +-----------+-----------+ | root | % | | mysql.sys | localhost | | root | localhost | +-----------+-----------+ 3 rows in set (0.00 sec)
5、客户端连接
参考文章:
https://www.jb51.net/article/139463.htm
https://www.cnblogs.com/jiyongjia/p/9527499.html
标签:ora ade roc article root 图片 64位 details nta
原文地址:https://www.cnblogs.com/djlsunshine/p/10911786.html