這篇文章主要為大家詳細介紹了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服務,發現新密碼生效。
以上是mysql 5.7.11 修改winx64初始密碼的方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!