mysql 5.7.11 winx64初始密碼修改。本站提示廣大學習愛好者:(mysql 5.7.11 winx64初始密碼修改)文章只能為提供參考,不一定能成為您想要的結果。以下是mysql 5.7.11 winx64初始密碼修改正文
從官網下載MySQL-5.7.11-winx64壓縮版,安裝後發現竟然有密碼,嘗試無果,通過修改密碼搞定
安裝成功後:
關閉mysql服務在跟目錄下修改文件my.ini,內容如下:注意兩點 1:內容中myql的安裝目錄換成讀者的安裝目錄;2最後一行代表登錄是否需要密碼,這裡我們繞過密碼登錄進入mysql修改密碼,所以不注釋skip-grant-tables
####################配置文件開始################### # 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. [client] default-character-set=utf8 [mysqld] port=3306 # D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64 basedir ="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/" datadir ="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/data/" tmpdir ="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/data/" socket ="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/data/mysql.sock" log-error="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/data/mysql_error.log" #server_id = 2 #skip-locking max_connections=100 table_open_cache=256 query_cache_size=1M tmp_table_size=32M thread_cache_size=8 innodb_data_home_dir="D:\Program Files\mysql-5.7.11-winx64\mysql-5.7.11-winx64/data/" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" skip-grant-tables ####################配置文件結束###################
修改保存後,在cmd中,由於我們已經在path配置了環境變量,所以我們可以直接啟動mysql
net start mysql
啟動成功後,登錄mysql
mysql -u root -p
密碼為空 這裡我們直接回車登錄成功
登錄成功後,我們修改數據庫執行如下
use mysql
update user set authentication_string=password("123456") where user="root";
這裡注意最後必需加上分號
成功後刷新
flush privileges;
致此我們密碼就修改成功了,退出關閉mysql服務,然後把my.ini中最後一行注釋掉,從新啟動mysql服務,發現新密碼生效。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。