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

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/279697.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279697.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279697.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

顯示器選三星還是飛利浦_如何為飛利浦色相燈設置計時器

顯示器選三星還是飛利浦Maybe you want to turn off your Philips Hue lights after a certain amount of time has passed, or have them blink as a reminder. Whatever your needs, here’s how to set a timer for your Philips Hue lights to have them automatically tur…

PIE SDK與OpenCV結合說明文檔

1.功能簡介 OpenCV是基于BSD許可(開源)發行的跨平臺計算機視覺庫,可以運行在Linux、Windows、Android和Mac OS操作系統上。它輕量級而且高效——由一系列 C 函數和少量 C 類構成,同時提供了Python、Ruby、MATLAB等語言的接口&…

js的棧堆與淺拷貝、深拷貝的理解

一:什么是堆棧? 我們都知道:在計算機領域中,堆棧是兩種數據結構,它們只能在一端(稱為棧頂(top))對數據項進行插入和刪除。 堆:隊列優先,先進先出;由操作系統自動分配釋放 ,存放函數的…

python面向對象基礎語言進階

在此感謝前輩們的指導:http://python.jobbole.com/80955/ https://www.cnblogs.com/wupeiqi/p/4766801.htmlhttps://www.cnblogs.com/paomaliuju/p/5122761.html https://www.cnblogs.com/goser/articles/7097728.html http://www.cnblogs.com/alex3714/articles/52…

ea 備份碼是什么_EA的原始訪問是什么,值得嗎?

ea 備份碼是什么EA’s Origin Access gives you access to more than 70 games, discounts, and new EA games before they’re released for a monthly (or yearly) subscription fee. But is it really worth it? EA的Origin Access可讓您訪問70多種游戲,打折游戲…

Https 加密原理分析

眾所周知,HTTP 協議通過明文傳輸,是不安全的。于是,就在 HTTP 協議的基礎上,進行了數據加密,也就誕生了 HTTPS 協議。注意,HTTPS 并不是一個新的協議,它只不過是在 HTTP 的基礎上加了一層 TLS (…

JS框架_(JQuery.js)純css3進度條動畫

百度云盤  傳送門  密碼&#xff1a;wirc 進度條動畫效果&#xff1a; <!DOCTYPE html> <html lang"zh"> <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge,chrome1">…

如何在Android主屏幕上添加熱點快捷方式

Portable Wi-Fi hotspots on your Android phone are great, because hotel Wi-Fi usually isn’t, but toggling that hotspot on and off is a pain. Here are several easy ways to add a hotspot widget to your home screen. 您的Android手機上的便攜式Wi-Fi熱點很棒&…

提高關鍵詞排名的28個SEO技巧

28個讓關鍵詞排名明顯改觀的SEO技巧&#xff1a; 關鍵詞位置、密度、處理 URL中出現關鍵詞&#xff08;英文&#xff09; 網頁標題中出現關鍵詞&#xff08;1-3個&#xff09; 關鍵詞標簽中出現關鍵詞&#xff08;1-3個&#xff09; 描述標簽中出現關鍵詞&#xff08;主關鍵…

SQLI DUMB SERIES-16

&#xff08;1&#xff09;無論怎么輸入&#xff0c;都沒有回顯&#xff0c;但當輸入 admin")#時&#xff0c;顯示登錄成功。若通過其他方法獲取數據庫的用戶名&#xff0c;可通過這個方法登錄成功。 &#xff08;2&#xff09;獲取其他信息可用考慮時間延遲注入。方法同1…

如何在YouTube視頻上禁用注釋

YouTube has that betcha-can’t-watch-just-one appeal to it, which is why YouTube’s annoyances become so pronounced the more you use it. Many of these features, such as annotations can be permanently disabled, making for a more enjoyable viewing experience…

Linux目錄配置及應放置的內容

Linux目錄配置及應放置的內容 /bin&#xff1a;系統有很多放置執行文件的目錄&#xff0c;但/bin比較特殊。因為/bin放置的是在用戶維護模式下還能夠被操作的命令。在/bin下面的命令可以被root與一般賬號所使用&#xff0c;主要有cat,chmod,chown,date,mv,mkdir,cp,bash等常用命…

快速實現一個Http回調組件

2019獨角獸企業重金招聘Python工程師標準>>> 快速實現一個Http回調組件 一、前情回顧 ? 我們平時在使用一些庫的時候&#xff0c;會遇到一些看起來很舒服的寫法&#xff0c;用起來感覺很簡單&#xff0c;而且寫法也很優雅&#xff0c;比如OkHttp&#xff0c;或者是…

MyBatis緩存通俗易懂

1.1 mybatis緩存介紹 如下圖&#xff0c;是mybatis一級緩存和二級緩存的區別圖解&#xff1a; Mybatis一級緩存的作用域是同一個SqlSession&#xff0c;在同一個sqlSession中兩次執行相同的sql語句&#xff0c;第一次執行完畢會將數據庫中查詢的數據寫到緩存&#xff08;內…

DVbbs8.2入侵思路與總結

dvbbs8.2后比較變態&#xff0c;目前還沒有特別好的方法&#xff0c;外面有人提到一種方法就是直接上傳php文件或者其它服務器支持文件&#xff0c;這個也是一個思路&#xff0c;不過很多時候&#xff0c;單獨的服務器不會支持這么多。dvbbs禁用了asp和asp.net的上傳&#xff0…

Python基礎教程:Python pass語句詳解

2019獨角獸企業重金招聘Python工程師標準>>> Python pass 語句 Python pass是空語句&#xff0c;是為了保持程序結構的完整性。 pass 不做任何事情&#xff0c;一般用做占位語句。 Python 語言 pass 語句語法格式如下&#xff1a; 實例&#xff1a; 學習從來不是一個…

Oracle數據庫在Nokia

Nokia固然今非昔比&#xff0c;但在手機市場仍是未瘦死的駱駝&#xff0c;有關報道顯示Nokia現役的數據庫(包括Oracle、MySQL、MSSQL)達到2300套之多&#xff0c; DBA團隊共有20多人&#xff0c;平均每人100多套庫。 Grid Control在過去5年中是最主要的、也幾乎是唯一的DBA管理…

css animation動畫

css 動畫&#xff1a; 動畫是CSS3中具有顛覆性的特征之一&#xff0c;可通過設置多個節點來精確控制一個或一組動畫&#xff0c;常用來實現復雜的動畫效果. 必要元素&#xff1a;a、通過keyframes指定動畫序列&#xff1b;自動補間動畫&#xff0c;確定兩個點&#xff0c;系統會…

甘特圖看起來很生硬?教你使用智能顏色裝飾你的甘特圖!(二)

在上一篇文章中我們了解到顏色在甘特圖中也有不同的作用。其中顏色在甘特圖中扮演著三個角色&#xff0c;才能使甘特圖對用戶有意義。 顏色決定甘特圖的外觀。顏色還可以用來定義甘特圖的語義。因此&#xff0c;它們幫助用戶更快地理解甘特圖所呈現的完整且常常復雜的現實。顏色…

網絡串流_串流NFL足球的最便宜方式(無需電纜)

網絡串流Football season is almost upon us. That means one thing: expensive cable or satellite TV packages. Okay, it also means beer commercials and overpriced stadium tickets and quarterbacks trying to sell you car insurance. But in terms of immediate cost…