標籤:load ace monit 中文 users 檔案 密碼登入 ODB 密碼
下載
訪問https://dev.mysql.com/downloads/mysql/下載mysql5.6
下載後解壓縮,看到如下目錄
安裝啟動mysql
1.添加環境變數【右鍵電腦】--》【屬性】--》【進階系統設定】--》【進階】--》【環境變數】--》【在第二個內容框中找到 變數名為Path 的一行,雙擊】 --> 【將MySQL的bin目錄路徑追加到變值值中,用 ; 分割】
2.初始化mysqld --initialize-insecure3.啟動MySQL服務mysqld # 啟動MySQL服務4.啟動MySQL用戶端並串連MySQL服務mysql -u root -p # 串連MySQL伺服器
開啟一個終端輸出mysqld啟動服務,另一個終端輸入mysql訪問mysql,出現介面mysql > 說明啟動mysql成功
5.查看mysql服務
takslist |findstr mysql
將MySQL服務製作成windows服務
注意:--install前,必須用mysql啟動命令的絕對路徑# 製作MySQL的Windows服務,在終端執行此命令:mysqld --install# 移除MySQL的Windows服務,在終端執行此命令:mysqld --remove註冊成服務之後,以後再啟動和關閉MySQL服務時,僅需執行如下命令:# 啟動MySQL服務net start mysql# 關閉MySQL服務net stop mysql
用管理員cmd輸入命令
殺掉mysql進程,啟動服務
啟動與停止mysql服務
登入設定密碼
C:\Windows\system32>mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.41 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql>mysql>mysql> select user(); # 查看使用者+----------------+| user() |+----------------+| [email protected] |+----------------+1 row in set (0.00 sec)mysql> exitByeC:\Windows\system32>mysql -u root -p #使用root使用者登入,預設密碼為空白Enter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.41 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> select user();+----------------+| user() |+----------------+| [email protected] |+----------------+1 row in set (0.00 sec)mysql> exitByeC:\Windows\system32>mysqladmin -u root -p password "123" #修改密碼123Enter password:Warning: Using a password on the command line interface can be insecure.C:\Windows\system32>mysql -u root -p #用密碼123登入資料庫Enter password: ***Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.41 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> exitByeC:\Windows\system32>mysqladmin -u root -p123 password "456" #修改密碼為456Warning: Using a password on the command line interface can be insecure.C:\Windows\system32>mysql -uroot -p456 #用密碼456登入資料庫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 7Server version: 5.6.41 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> select user() -> ;+----------------+| user() |+----------------+| [email protected] |+----------------+1 row in set (0.00 sec)
破解密碼
#1 關閉mysql#2 在cmd中執行:mysqld --skip-grant-tables#3 在cmd中執行:mysql#4 執行如下sql:update mysql.user set authentication_string=password(‘‘) where user = ‘root‘;flush privileges;#5 tskill mysqld #或taskkill -f /PID 進程號#6 重新啟動mysql
停止mysql服務,跳過授權方式啟動
修改mysql伺服器root密碼
C:\Users\>mysql -uroot -p #使用空密碼登入Enter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.6.41 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> select user();+--------+| user() |+--------+| [email protected] |+--------+1 row in set (0.00 sec)mysql> update mysql.user set password=password("111") where user="root" and host="localhost"; #修改密碼Query OK, 1 row affected (0.01 sec)Rows matched: 1 Changed: 1 Warnings: 0mysql> flush privileges; #重新整理許可權Query OK, 0 rows affected (0.03 sec)mysql> exitBye
重啟mysql伺服器,使用新密碼111登入
統一字元編碼
強調:設定檔中的注釋可以有中文,但是配置項中不能出現中文
#在mysql的解壓目錄下,建立my.ini,然後配置#1. 在執行mysqld命令時,下列配置會生效,即mysql服務啟動時生效[mysqld];skip-grant-tablesport=3306character_set_server=utf8default-storage-engine=innodbinnodb_file_per_table=1#解壓的目錄basedir=C:\pythonStudy\mysql5.6#data目錄datadir=C:\pythonStudy\mysql5.6\data\ #在mysqld --initialize時,就會將初始資料存入此處指定的目錄,在初始化之後,啟動mysql時,就會去這個目錄裡找資料#2. 針對用戶端命令的全域配置,當mysql用戶端命令執行時,下列配置生效[client]port=3306default-character-set=utf8user=rootpassword=111#3. 只針對mysql這個用戶端的配置,2中的是全域配置,而此處的則是只針對mysql這個命令的局部配置[mysql];port=3306;default-character-set=utf8user=egonpassword=4573
my.ini字元編碼設定
#1. 修改設定檔[mysqld]default-character-set=utf8 [client]default-character-set=utf8 [mysql]default-character-set=utf8#mysql5.5以上:修改方式有所改動[mysqld]character-set-server=utf8collation-server=utf8_general_ci[client]default-character-set=utf8[mysql]default-character-set=utf8#2. 重啟服務#3. 查看修改結果:\sshow variables like ‘%char%‘
windows mysql預設安裝字元
修改mysql字元後,重啟查看新設定的utf-8字元
windows安裝mysql