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 ...
随机推荐
- Redis性能点
AliRedis是来自阿里巴巴的基于Redis改造的缓存产品,目前还未开源.网上只能搜到这么一篇资料<AliRedis单机180w QPS, 8台服务器构建1000w QPS Cache集群&g ...
- vim中替换命令
在VIM中进行文本替换: 1. 替换当前行中的内容: :s/from/to/ (s即substitude) :s/from/to/ : 将当前行中的 ...
- Druid Monitor监控JavaSE,杀cmd端口进程
1.需要在启动命令添加相关jvm参数 -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname -Dcom.sun.management.jm ...
- jQuery div内容间隔1秒动态向上滚动HTML、JS代码
demo1: <!DOCTYPE html> <html> <head> <title>div内容间隔1秒动态滚动</title> < ...
- 深入jQuery中的data()
引入 data函数在jQuery中看起来很不起眼, 就像沙滩上一颗平凡的沙子, 但仔细一瞅, 却惊讶的发现data是jQuery中无比重要的一环, 甚至jQuery中各种事件都基于此. data有什么 ...
- Android Studio tips2
Android不推荐把字符串进行硬编码,一般的做法是把字符串定义在laylout里,并在xml文件里对键值进行引用 例如<第一行代码>中 Hello word程序中"Hello ...
- .NET core mvc on Docker
安装Docker 参考:http://www.cnblogs.com/windchen/p/6224233.html 下载.NET CORE MVC镜像 sudo docker pull regist ...
- js 滚动 学习
// s:= 'document.getElementsByName(''seccodeverify'')[0].scrollTop=100;'; // s:='scrollTo(0,document ...
- 谈谈springMVC和Strut2的理解
关于struts2框架原理 执行流程 struts2框架的核心是一个过滤器,我们编写的action类都继承ActionSupport的接口(顶层是一个过滤器filter),用户发送请求,经过核心过滤器 ...
- python数据统计,总数,平均值等
一般我们进行数据统计的时候要进行数据摸查,可能是摸查整体的分布情况啊.平均值,标准差,总数,各分段的人数啊.这时候用excel或者数据库统计都不方便. 我要统计的一个文件,太大了,还得分成15个文件, ...