mysq安装以及修改密码
安装版MySQL是不能一键安装的,下载下来是压缩包,解压后只要进行相关配置就可以正常使用;
文章主要是记录一下,以防自己忘记;
1、首先在mysql官网--http://dev.mysql.com/downloads/mysql/ 下载mysql;
2、下载后解压到对应路径
我是放在 D:\mysql-5.7.14-winx64\ 里面,解压完后改名,可以自己进行重命名;
3、配置环境变量
找到--高级系统变量--环境变量--系统变量
新建环境变量:变量名 MYSQL_HOME,变量值 D:\mysql-5.7.14-winx64;
找到path--编辑--在最后面加上 ;%MYSQL_HOME%/bin ;
(这是我的mysql的bin目录,请设置自己电脑上相应的目录); 然后确定保存;
4,检查mysql目录下有没有data目录;
如果有data目录,忽略本点;
如果没有,win+r 打开运行,输入cmd进入命令窗;
进入mysql所在盘符。比如:d:
然后cd到mysql的bin目录,执行如下语句: mysqld --initialize-insecure --user=mysql ;data目录就生成成功了
5,配置mysql目录内的 my-default.ini (没有就新建个)
在[mysqld]下,修改以下三个参数,默认是用#注释的,去掉#;
basedir = D:\mysql-5.7.14-winx64
datadir = D:\mysql-5.7.14-winx64\data
port = 3306
注意:basedir 和datadir是我本地mysql的目录,请设置自己电脑上相应的目录;
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = E:\mysql-5.7.16-winx64
datadir = E:\mysql-5.7.16-winx64\data
port = 3306
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
ql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
loose-default-character-set = utf8
character_set_server = utf8
[client]
loose-default-character-set = utf8
port = 3306
user=root
password=admin
6,安装;
用管理员权限打开系统命令窗口,
输入:mysqld --install
提示service successfully installed安装成功;
7,停止和启动mysql
启动:net start mysql
停止:net stop mysql
8,进入mysql以及修改密码
在mysql目录下,编辑 my-default.ini
在[mysqld]下添加一行 skip-grant-tables 暂时取消密码;
直接输入:SET PASSWORD = PASSWORD('你的新密码');
重启mysql,用 mysql -uroot -p123456。
########
其他更改密码方法
1,重启mysql,;
2,输入 mysql -uroot -p 按回车,如果提示输入密码,直接回车即可;
, 3,登陆成功后,输入 update mysql.user set authentication_string=password('123456') where user='root' and Host = 'localhost'; 将密码先修改为123456;
4,输入 flush privileges;刷新保存;
5,删除 my-default.ini 中刚刚添加的 skip-grant-tables 保存;
6,exit;或quit; 退出mysql;
7,重启mysql;
8,使用新密码登陆: mysql -uroot -p123456 回车即可登陆成功;
9,ok了!
mysql 5.7.16 忘记root 密码 如何修改root密码
今天在电脑上安装 mysql5.7.16 (压缩包)时,在初始化data文件夹之后,没有记住密码,DOS框没有显示,没办法,为了学习一下怎么修改密码,在网上找了好多方法去解决,最终还是解决了,下面来看一下这种方法的具体操作:
2. 打开DOS窗口,转到mysql\bin目录
3. 输入mysqld --skip-grant-tables 回车
--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。
4. 再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录。
5. 输入mysql回车,如果成功,将出现MySQL提示符 >。
6. 连接权限数据库: use mysql; (别忘了最后加分号) 。
7. 改密码:update user set password=password("123") where user="root"; (别忘了最后加分号) 。
如果修改密码出现
**mysql修改密码错误 ERROR 1054 (42S22)**
则使用 mysql>update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';

在my.init文件下新增data目录(datadir = F:\mysqldata )
最新解压版本的mysql 解压安装的时候报错
D:\mysql\mysql-5.7.10-winx64\bin>net start mysql
MySQL 服务正在启动 ....
MySQL 服务无法启动。
服务没有报告任何错误。
请键入 NET HELPMSG 3534 以获得更多的帮助。
mysql下面是没有data文件夹的,此文件夹不需要自己建
D:\mysql\mysql-5.7.10-winx64\bin> mysqld --console
2015-12-21T07:25:01.465815Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-12-21T07:25:01.465815Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They willbe merged with strict mode in a future release.
2015-12-21T07:25:01.465815Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2015-12-21T07:25:01.465815Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2015-12-21T07:25:01.467815Z 0 [Note] mysqld (mysqld 5.7.10-log) starting as process 3708 ...
2015-12-21T07:25:01.491816Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=PC201305252052-bin' to avoid this problem.
2015-12-21T07:25:01.527818Z 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-12-21T07:25:01.528818Z 0 [Note] InnoDB: Uses event mutexes
2015-12-21T07:25:01.531819Z 0 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2015-12-21T07:25:01.535819Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-12-21T07:25:01.540819Z 0 [Note] InnoDB: Number of pools: 1
2015-12-21T07:25:01.544819Z 0 [Note] InnoDB: Not using CPU crc32 instructions
2015-12-21T07:25:01.654826Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2015-12-21T07:25:01.705829Z 0 [Note] InnoDB: Completed initialization of buffer pool
2015-12-21T07:25:01.834836Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2015-12-21T07:25:01.991845Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2015-12-21T07:25:01.994845Z 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12MB. Physically writing the file full; Please wait ...
2015-12-21T07:25:02.264861Z 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2015-12-21T07:25:02.275861Z 0 [Note] InnoDB: 96 redo rollback segment(s) found.
96 redo rollback segment(s) are active.
2015-12-21T07:25:02.276861Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2015-12-21T07:25:02.284862Z 0 [Note] InnoDB: Waiting for purge to start
2015-12-21T07:25:02.335865Z 0 [Note] InnoDB: 5.7.10 started; log sequence number 1209980
2015-12-21T07:25:02.338865Z 0 [Note] Plugin 'FEDERATED' is disabled.
2015-12-21T07:25:02.339865Z 0 [Note] InnoDB: Loading buffer pool(s) from F:\mysqldata\ib_buffer_pool
2015-12-21T07:25:02.339865Z 0 [Note] InnoDB: not started mysqld: Table 'mysql.plugin' doesn't exist
2015-12-21T07:25:02.348865Z 0 [Note] InnoDB: Buffer pool(s) load completed at 151221 15:25:02
2015-12-21T07:25:02.351865Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2015-12-21T07:25:02.396868Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2015-12-21T07:25:02.401868Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2015-12-21T07:25:02.402868Z 0 [Note] Server hostname (bind-address): '*'; port:3306
2015-12-21T07:25:02.415869Z 0 [Note] IPv6 is available.
2015-12-21T07:25:02.416869Z 0 [Note] - '::' resolves to '::';
2015-12-21T07:25:02.419869Z 0 [Note] Server socket created on IP: '::'.
2015-12-21T07:25:02.430870Z 0 [Warning] Failed to open optimizer cost constant tables
2015-12-21T07:25:02.436870Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2015-12-21T07:25:02.440871Z 0 [ERROR] Aborting
2015-12-21T07:25:02.441871Z 0 [Note] Binlog end
2015-12-21T07:25:02.457872Z 0 [Note] Shutting down plugin 'ngram'
2015-12-21T07:25:02.457872Z 0 [Note] Shutting down plugin 'partition'
2015-12-21T07:25:02.460872Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2015-12-21T07:25:02.463872Z 0 [Note] Shutting down plugin 'ARCHIVE'
2015-12-21T07:25:02.468872Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2015-12-21T07:25:02.468872Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2015-12-21T07:25:02.475873Z 0 [Note] Shutting down plugin 'MyISAM'
2015-12-21T07:25:02.476873Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2015-12-21T07:25:02.480873Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2015-12-21T07:25:02.482873Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2015-12-21T07:25:02.493874Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2015-12-21T07:25:02.495874Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2015-12-21T07:25:02.498874Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2015-12-21T07:25:02.503874Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2015-12-21T07:25:02.509875Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2015-12-21T07:25:02.513875Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2015-12-21T07:25:02.518875Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2015-12-21T07:25:02.521875Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2015-12-21T07:25:02.524875Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2015-12-21T07:25:02.528876Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2015-12-21T07:25:02.531876Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2015-12-21T07:25:02.537876Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2015-12-21T07:25:02.539876Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2015-12-21T07:25:02.542876Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2015-12-21T07:25:02.545877Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2015-12-21T07:25:02.553877Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2015-12-21T07:25:02.555877Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2015-12-21T07:25:02.558877Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2015-12-21T07:25:02.561878Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2015-12-21T07:25:02.563878Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2015-12-21T07:25:02.566878Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2015-12-21T07:25:02.572878Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2015-12-21T07:25:02.574878Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2015-12-21T07:25:02.577878Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2015-12-21T07:25:02.580879Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2015-12-21T07:25:02.582879Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2015-12-21T07:25:02.584879Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2015-12-21T07:25:02.586879Z 0 [Note] Shutting down plugin 'InnoDB'
2015-12-21T07:25:02.587879Z 0 [Note] InnoDB: FTS optimize thread exiting.
2015-12-21T07:25:02.589879Z 0 [Note] InnoDB: Starting shutdown...
2015-12-21T07:25:02.690885Z 0 [Note] InnoDB: Dumping buffer pool(s) to F:\mysqldata\ib_buffer_pool
2015-12-21T07:25:02.698885Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 151221 15:25:02
2015-12-21T07:25:03.850951Z 0 [Note] InnoDB: Shutdown completed; log sequence number 1209999
2015-12-21T07:25:03.853951Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2015-12-21T07:25:03.863952Z 0 [Note] Shutting down plugin 'MEMORY'
2015-12-21T07:25:03.866952Z 0 [Note] Shutting down plugin 'CSV'
2015-12-21T07:25:03.876953Z 0 [Note] Shutting down plugin 'sha256_password'
2015-12-21T07:25:03.879953Z 0 [Note] Shutting down plugin 'mysql_native_password'
2015-12-21T07:25:03.882953Z 0 [Note] Shutting down plugin 'binlog'
2015-12-21T07:25:03.892954Z 0 [Note] mysqld: Shutdown complete
D:\mysql\mysql-5.7.10-winx64\bin> mysqld --initialize
2015-12-21T07:28:50.310904Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-12-21T07:28:50.311904Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They willbe merged with strict mode in a future release.
2015-12-21T07:28:50.311904Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2015-12-21T07:28:50.318904Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting .
2015-12-21T07:28:50.324905Z 0 [ERROR] Aborting
上面的错误是自己建了data文件夹之后 用 mysqld --initialize报错。
删除之前建的data文件夹,然后注释my.init文件下的datadir,由mysql自己创建即可。
D:\mysql-5.7.10-winx64\bin>mysqld --initialize
D:\mysql-5.7.10-winx64\bin>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。
mysq安装以及修改密码的更多相关文章
- mysql5.7安装和修改密码
mysql5.7安装 第一 下载 https://downloads.mysql.com/archives/community/ 首先下载mysql5.7.18zip安装包 根据电脑配置选择32/64 ...
- mac 安装mysql 修改密码
我草!!! 上网查资料,安装mysql,一大推废话,简直就是他妈的瞎扯淡,真是能他妈的瞎编,草! 为了不让后面的同学看到那些狗屁不通的资料,我把自己安装mysql的步骤,以及修改mysql密码的方法梳 ...
- mysql-8.0-winx64安装以及修改密码
一.下载安装包(https://dev.mysql.com/downloads/mysql/) 二.添加my.ini配置文件 打开刚刚解压的文件夹 C:\mysql-8.0.16-winx64,在该文 ...
- mysql安装及修改密码
MySQL5.7更改密码时出现ERROR 1054 (42S22): Unknown column 'password' in 'field list' C:\Users\Administrator& ...
- day40——数据库、数据库分类、安装、修改密码、字符集编码、简单语句介绍
day40 详情请看:https://www.cnblogs.com/clschao/articles/9907529.html 数据库 数据库 简而言之可视为电子化的文件柜--存储电子文件的处所,用 ...
- CentOS7 安装MySQL8修改密码
1. 添加MySQL8的本地源 执行以下命令获取安装MySQL源 [root@virde ~]# wget https://repo.mysql.com//mysql80-community-rele ...
- mysql安装与修改密码
数据库基本概念:数据的仓库 数据库服务器-->数据库-->表-->记录-->属性(列,字段) unix下数据库服务安装: apt-get install -y mysql-se ...
- Linux下的 Mysql 8.0 yum 安装 并修改密码
1.MySQL版本: mysql> select @@version;+-----------+| @@version |+-----------+| 8.0.18 |+-----------+ ...
- Mysql,zip格式安装、修改密码、建库
Mysql,zip格式 1. Mysql 主目录最好别带有"- ."之类的字符 2. Mysql 配置环境变量 Path 环境变量后加上 mysql解压路径:eg:E:\mysql ...
随机推荐
- Java代理(jdk静态代理、动态代理和cglib动态代理)
一.代理是Java常用的设计模式,代理类通过调用被代理类的相关方法,并对相关方法进行增强.加入一些非业务性代码,比如事务.日志.报警发邮件等操作. 二.jdk静态代理 1.业务接口 /** * 业务接 ...
- HTTP权威指南笔记-1.概述
1.1 通讯 Web内容是存储在服务器上的,Web服务所使用的是HTTP协议,所以经常称为HTTP服务器.通讯过程为客户端(正常我们所使用的)发出请求,服务端根据客户端的HTTP请求响应相应数据,这就 ...
- Josn序列化与反序列化
using System.Web.Script.Serialization; /// <summary> /// 序列化器 /// </summary&g ...
- WCF启用日志追踪
调用使用http post调用WCF Restful服务时,WCF会自动反序列化body里的实体,如果实体反序列化不成功时,会返回一个请求错误,让去看服务器日志.需要启用日志追踪功能,才能看到具体的情 ...
- Error:(1, 1) error: illegal character: \65279解决方法
NotePad++,选择格式,选择转为UTF-8无BOM格式,即可解决,感谢http://tzwzero-163-com.iteye.com/blog/1696605
- UICollectionReusableView 使用时的一些问题
在使用UICollectionView 时, 设置分区头时, - (UICollectionReusableView *)collectionView:(UICollectionView *)coll ...
- java命名规范有感
一. 注()里的内容是自己的吐槽 二. 命名规约 不能以下划线或美元符开始和结尾.反例:_name,$name,name_,name$.(我就从来没这样用过) 不能使用拼音和英文组合方式命名.更不能以 ...
- nodejs学习笔记(一)
终于开始学NodeJs了 说说遇到的问题吧 1.安装express npm install -g express(按道理说,这个全局安装是没问题的,但他就是出问题了) 解决方案: 来源:http:// ...
- HashTable 简述
1.解释:使用了映射函数,把值映射到对应的位置,key-> address, address是表中的存储位置,不是实际的地址: 2.Hash 函数设计, 分布合理,冲突少,利用率平衡,利用率 ...
- angularjs(二)模板终常用的指令的使用方法
通过使用模板,我们可以把model和controller中的数据组装起来呈现给浏览器,还可以通过数据绑定,实时更新视图,让我们的页面变成动态的.ng的模板真是让我爱不释手.学习ng道路还很漫长,从模板 ...