windows - mysql
Windows:(mysql)操作: 0.下载安装mysql www.mysql.org downloads community 5.7.21 下载5.6 Microsoft Windows 解压到C: C:\mysql-5.6.39-winx64 C:\mysql-5.6.39-winx64\bin bin/mysql 客户端 bin/mysqld 服务端 设置环境变量: 我的电脑 属性 高级系统设置 环境变量 系统变量 Path 新建 将 C:\mysql-5.6.39-winx64\bin 粘贴 确定... 启动cmd: >>>:mysqld >>>:mysql 将mysqld做成系统服务,开机自动启动: 1.先杀死之前开启的mysqld: C:\Users\bj>tasklist | findstr mysql mysqld.exe 67404 Console 1 453,740 K C:\WINDOWS\system32>taskkill /F /PID 67404 成功: 已终止 PID 为 66732 的进程。 2.制作系统服务: C:\WINDOWS\system32>mysqld --install 制作系统服务 Service successfully installed. C:\WINDOWS\system32>mysqld --remove 解除系统服务 Service successfully removed. 3.服务 服务-->MySQL-->启动-->ok... 或者: C:\WINDOWS\system32>net start MySQL MySQL 服务正在启动 . MySQL 服务已经启动成功。 C:\WINDOWS\system32>net stop MySQL MySQL 服务正在停止. MySQL 服务已成功停止。 1.验证安装成功 C:\Users\bj>mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | ODBC@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 2. root默认没有密码 C:\Users\bj>mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 3.设置初始密码: C:\Users\bj>mysqladmin -uroot -p password "123" Enter password: Warning: Using a password on the command line interface can be insecure. C:\Users\bj>mysql -uroot -p123 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 4.修改密码 C:\Users\bj>mysqladmin -uroot -p123 password "456" Warning: Using a password on the command line interface can be insecure. C:\Users\bj>mysql -uroot -p456 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 5.忘记密码,破解密码,跳过授权表; C:\WINDOWS\system32>net stop MySQL MySQL 服务正在停止. MySQL 服务已成功停止。 C:\WINDOWS\system32>mysqld --skip-grant-tables # 跳过授权表 启动 mysqld 2018-04-08 10:56:49 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-04-08 10:56:49 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2018-04-08 10:56:49 0 [Note] mysqld (mysqld 5.6.39) starting as process 66732 ... C:\Users\bj>mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +--------+ | user() | +--------+ | ODBC@ | +--------+ 1 row in set (0.00 sec) mysql> exit Bye C:\Users\bj>mysql -uroot -p # 跳过了授权 不需要输入密码了 Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +--------+ | user() | +--------+ | root@ | +--------+ 1 row in set (0.00 sec) mysql> update mysql.user set password=password("123") where user="root" and host="localhost"; # 修改密码 Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye C:\Users\bj>mysql -uroot -p123 # 修改密码成功 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 11 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye # 杀死之前 开启的 跳过授权的 mysqld C:\Users\bj>tasklist | findstr mysql mysqld.exe 66732 Console 1 453,740 K C:\WINDOWS\system32>taskkill /F /PID 66732 成功: 已终止 PID 为 66732 的进程。 C:\WINDOWS\system32>net start mysql MySQL 服务正在启动 . MySQL 服务已经启动成功。 C:\Users\bj>mysql -uroot -p123 # 用之前设置的密码 登录便可 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 6.登录mysql的两种方式: C:\Users\bj>mysql -uroot -p123 C:\Users\bj>mysql -uroot -p123 -h 127.0.0.1 -P 3306 # 默认端口是3306 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye C:\Users\bj>mysql -h 127.0.0.1 -P 3306 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> select user(); +----------------+ | user() | +----------------+ | ODBC@localhost | +----------------+ 1 row in set (0.00 sec) mysql> exit Bye 7.统一字符编码: C:\WINDOWS\system32>mysql -uroot -p123 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 17 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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> \s -------------- mysql Ver 14.14 Distrib 5.6.39, for Win64 (x86_64) Connection id: 17 Current database: Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.6.39 MySQL Community Server (GPL) Protocol version: 10 Connection: localhost via TCP/IP Server characterset: latin1 Db characterset: latin1 Client characterset: gbk Conn. characterset: gbk TCP port: 3306 Uptime: 1 hour 12 min 59 sec Threads: 1 Questions: 36 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.008 ----------------------- 增加: C:\mysql-5.6.39-winx64\my.ini #1. 修改配置文件 [mysqld] default-character-set=utf8 [client] default-character-set=utf8 [mysql] default-character-set=utf8 #mysql5.5以上:修改方式有所改动 [mysqld] character-set-server=utf8 collation-server=utf8_general_ci [client] default-character-set=utf8 [mysql] default-character-set=utf8 my.ini [mysqld] character-set-server=utf8 collation-server=utf8_general_ci [client] default-character-set=utf8 [mysql] default-character-set=utf8 net stop mysql 再重启 net start mysql mysql> \s -------------- mysql Ver 14.14 Distrib 5.6.39, for Win64 (x86_64) Connection id: 4 Current database: Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.6.39 MySQL Community Server (GPL) Protocol version: 10 Connection: localhost via TCP/IP Server characterset: utf8 Db characterset: utf8 Client characterset: utf8 Conn. characterset: utf8 TCP port: 3306 Uptime: 1 min 9 sec Threads: 1 Questions: 6 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.086 -------------- 或者: mysql> show variables like '%char%'; +--------------------------+----------------------------------------+ | Variable_name | Value | +--------------------------+----------------------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | C:\mysql-5.6.39-winx64\share\charsets\ | +--------------------------+----------------------------------------+ 8 rows in set (0.00 sec)
转载于:https://www.cnblogs.com/mumupa0824/p/9415332.html
windows - mysql相关推荐
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin,mysql8.0.1/mysql5.7.22+centos7,windows mysql安装、配置...
介绍如何在CentOs6.2下面使用YUM配置安装LAMP环境,一些兄弟也很喜欢使用编译的安装方法,个人觉得如果不是对服务器做定制,用yum安装稳定简单,何必去download&make&am ...
- windows mysql.tar安装_MySQL的安装
MySQL数据库服务的推荐安装方法是通过MySQL网站直接下载安装.这种方法在一些不同的平台上都有支持,仅在不同的平台上的安装细节上略有不同.然而,其主要步骤都一样.请注意你需要管理好权限设置以完成此 ...
- Windows 安装 MySQL 8 zip版安装,及Windows MySQL多实例
Windows 安装 MySQL 8 zip版安装,及Windows MySQL多实例 目录 一.下载MySQL压缩包 二.设置系统环境变量 三.解压并新建配置文件 四.注册 Windows 服务 ...
- Windows Mysql 版本更新
Windows Mysql 版本更新 感谢大佬文章,借鉴学习 超详细教你怎么升级Mysql的版本_Mysql_脚本之家 (jb51.net) 前言 软件时代变迁,更新迭代之快,我们每天都需要使用很多的 ...
- windows mysql增量备份_windows下mysql增量备份与全备份批处理
win下的全备批处理 批处理用于游戏服务器,经过严格测试,且正式使用,主要用来完全备份数据库,当然.这只是将数备份出来 ,至于如何将备份出来的数据远程传送的远程服务器上可以调用ftp的功能,此脚本并未 ...
- windows mysql 主从_mysql读写分离实战二-windows 上mysql主从数据库搭建及问题总结
根据前篇web项目的搭建后,需要搭建主从数据库,这里在windows服务器上搭建了主从结构的mysql,这里在记录下在本机模拟搭建过程 在windows上安装和linux还是有些不同,不注意就会耽误不 ...
- windows mysql 开启日志功能_Windows下开启mysql日志功能
Windows下开启mysql日志功能 Mysql日志功能默认是不打开的,毕竟打开日志,使用时间久了会占用很大空间. 方法: 找到MySql安装目录,修改 my.ini文件(在未设置的前提下) 在my ...
- windows mysql 自动备份的几种方法
基于之前的文章方法,加入批处理命令即可实现自动备份.只是由于批处理命令中对于备份文件的名字按照时间命名比较特别,所以特别整理一文. 1.复制date文件夹备份 ==================== ...
- windows mysql提示:1045 access denied for user 'root'@'localhost' using password yes 解决方案
win7 MySql5.6.17 提示:1045 access denied for user 'root'@'localhost' using password yes 从网上找到的解决方法,以此博 ...
最新文章
- shell 练习(13) —— 监控 httpd 进程数是否异常
- VC++2012编程演练数据结构《31》狄杰斯特拉算法
- mysql+查看端口和进程,linux查看端口、进程以及kill情况
- read .off file in matlab
- 微信小程序手机号快速填写及会员卡开卡组件开放
- LOCAL_MODULE_TAGS 选项说明
- 2月11日 TensorBoard+DNN+CNN
- USB加密狗复制克隆软件
- 关于vba word的一些用法
- 软件设计模式经典书籍推荐
- Java企业商品进销存管理系统
- Windows环境下sublime text 3搭建前端开发环境
- 如何把团队带成一盘散沙?
- python中函数定义的关键字_python中定义函数的关键字是什么
- OpenStack历史知识
- 安装mysql_python
- APS 与 MES 的区别是什么?
- ASR项目实战-从源码开始构建Kaldi
- 【基于TCP的在线词典】
- 牛客网暑期ACM多校训练营(第六场) C.Generation I (思维+逆元+组合数学)
热门文章
- 五大板块(3)—— 结构体
- android 系统gpu 调试_【资讯】高通公布首批可OTA更新GPU驱动手机:谷歌Pixel 4/三星S10在列...
- java json删除节点_指定json的某个节点进行增、删、改
- Error:java: 无效的目标发行版: 11解决方案
- Spring系列(三):@ComponentScan注解用法介绍
- C#实现图片的无损压缩
- readkeyboard方法_Linux笔记(12)| 几种并发式IO的实现方法
- 生产三码 黑苹果_黑苹果OC配置工具:OpenCore Configurator v2.15.2.0
- python字典append_python中字典重复赋值,append到list中引发的异常
- 文件系统(文件系统目录结构、磁盘分区、虚拟文件系统)、linux内核结构框图