centos下安裝mysql5.7後,強行修改mysql的root密碼
昨天在centos下安裝mysql5.7後,卻發現無法登陸,才新安裝的mysql,初始密碼應該沒有,但是無論如何都無法登陸(提示密碼錯誤),沒辦法,只好強行修改mysql密碼。
輸入
[[email protected] bin]# mysqld_safe --skip-grant-tables &
這句話相當於進入mysql的安全模式。
輸入上面這條命令可能會出現錯誤如下:
[3] 7135 [2] Exit 127 mysqld_stae --skip-grant-tables [[email protected] bin]# Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. grep: write error: Broken pipe 2016-04-02T10:16:02.306271Z mysqld_safe Logging to '/opt/mysql/data/localhost.localdomain.err'. 2016-04-02T10:16:02.315564Z mysqld_safe The file /usr/local/mysql/bin/mysqld does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information [3]+ Exit 1 mysqld_safe --skip-grant-tables
根據錯誤提示在/usr/local下建立資料夾mysql/bin/mysqld
建立好資料夾後,準備開啟mysql,但是在這之前先檢查一下mysql是否開啟
[[email protected] ~]# ps -ef|grep mysqld
如果開啟使用kill -15 [pid]殺死mysql。如下:
[[email protected] ~]# ps -ef|grep mysqld
root 6946 1 0 18:15 ? 00:00:00 /bin/sh /opt/mysql/bin/mysqld_safe --datadir=/opt/mysql/data --pid-file=/opt/mysql/data/localhost.localdomain.pid
mysql 7104 6946 0 18:15 ? 00:00:00 /opt/mysql/bin/mysqld --basedir=/opt/mysql --datadir=/opt/mysql/data --plugin-dir=/opt/mysql/lib/plugin --user=mysql --log-error=/opt/mysql/data/localhost.localdomain.err --pid-file=/opt/mysql/data/localhost.localdomain.pid --port=3306
root 7558 7542 0 18:22 pts/0 00:00:00 grep mysqld
[ [email protected] ~]# kill -15 7104
再次使用 ps -ef|grep mysqld 確認mysql已經被殺死
開啟mysql,如下:
[[email protected] ~]# mysqld_safe --skip-grant-tables & [1] 7566 [[email protected] ~]# 2016-04-02T10:23:22.463266Z mysqld_safe Logging to '/opt/mysql/data/localhost.localdomain.err'. 2016-04-02T10:23:22.514395Z mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.11 MySQL Community Server (GPL) Copyright (c) 2000, 2016, 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密碼:注意!以前的password欄位,在mysql5.7已經被改為了authentication_string。在password()函式裡面輸入你的新密碼,記得加單引號哦。
mysql> UPDATE mysql.user SET authentication_string=password('YourPassword') WHERE User='root' AND Host='localhost';
好了,測試一下用新密碼能不能進入:
[[email protected] ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.11
Copyright (c) 2000, 2016, 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>
新密碼修改成功!
一定要注意以前的password變成了authentication_string
相關推薦
centos下安裝mysql5.7後,強行修改mysql的root密碼
昨天在centos下安裝mysql5.7後,卻發現無法登陸,才新安裝的mysql,初始密碼應該沒有,但是無論如何都無法登陸(提示密碼錯誤),沒辦法,只好強行修改mysql密碼。 輸入 [[email protected] bin]# mysqld_safe --
MySQL5.7....CentOS下安裝MySQL5.7
1.檢查解除安裝老版本mysql rpm -qa | grep -i mysql #解除安裝與mysql相關的服務
linux(centos)下安裝mysql5.7(mysql8.0類似)
本人使用的是centos64位系統。mysql安裝步驟如下: 1、下載mysql安裝包---二進位制壓縮包: 下載免費社群版本: 2、檢視系統是否自帶mysql,若有則將其解除安裝: 3、解壓壓縮包: 將壓縮包放在你需要安裝的路徑下:a:新建路徑
CentOS下安裝mysql5.7.18的正確姿勢
前段日子,學著在虛擬機器上裝一個mysql,但安了好幾次都失敗了,這讓我很尷尬,感覺我還是比較適合mongodb。。。。。不過機智的我最終還是把Mysql5.7.18裝好了,下面就給大家分享一下如何正確的安裝MYSQL5.7.18。 首先,到官網上下載mysq
在 Server 2008 企業版下, 安裝 IIS 7 後,勾選好 請求篩選模塊了。安裝完畢後,"請求篩選"卻不顯示!
顯示 server ext table figure feature new ui s where 下載並安裝 Administration Pack 到你的Windows Server 2008 上。可以通過下面的鏈接來下載Administration Pack。 htt
linux 下安裝Mysql5.7以後版本後不知道密碼如何登陸
linux 下安裝Mysql5.7以後版本後不知道密碼如何登陸 第一次在linux下安裝mysql,安裝成功以後不知道密碼無法登陸,看了好多部落格說初始密碼為空,然而並不是這樣,輸入空密碼會報錯,後來才知道和版本有關。5.7之前的版本預設是沒有密碼的,只需在伺服器上直接登入,甚至使用者名
centos7.2下安裝mysql5.7,使用rpm包安裝
0、環境 本文作業系統: CentOS 7.2.1511 x86_64 MySQL 版本: 5.7.16 1、解除安裝系統自帶的 mariadb-lib [[email protected] ~]# rpm -qa|grep mariadb mariadb-
centos7下安裝mysql5.7,使用rpm包安裝
轉載自(https://www.cnblogs.com/pythonal/p/6141516.html) 0、環境 本文作業系統: CentOS 7.2.1511 x86_64 MySQL 版本: 5.7.16 1、解除安裝系統自帶的 mariadb-lib [[email
centos7(vultr)下安裝mysql5.7(各種坑:ERROR 1045 (28000),ERROR 1820 (HY000):ERROR 1819 (HY000))
環境:centos7 雲伺服器廠商:vultr mysql版本:5.7 新增 MySQL YUM 源 根據自己的作業系統選擇合適的安裝源,通過 rpm -Uvh 安裝。 wget 'https://dev.mysql.com/get/mysql57-community-relea
Windows下安裝Mysql5.7
環境變量 環境 cas 初始化 地址 5.7 name init spa 版本如下: Windows10 Mysql5.7.18 下載地址:https://dev.mysql.com/downloads/mysql/ 本人解壓到了:D:\Program Files (x
Linux系統下安裝Mysql5.7.18教程收集分享
最後一行 sdn 作者 tails lin 分享 使用 心態 html 本人最近服務器新手入門,需要搭建一個在linux虛擬機上的服務器 第一天再裝虛擬機,選的linux系統CentOS,一切順利。 第二天,要給虛擬機裝Mysql,但是需要用到命令行進行安裝/操作等,我是一
CentOS7下安裝MySQL5.7安裝與配置(YUM)
centos7下安裝mysql5.7安裝與配置(yum) CentOS7下安裝MySQL5.7安裝與配置(YUM) 安裝環境:CentOS7 64位 MINI版,安裝MySQL5.71、配置YUM源 在MySQL官網中下載YUM源rpm安裝包:http://dev.mysql.co
linux下安裝mysql5.7.17及簡單配置
http mkdir exp 重要 ble ges 選擇 bsp 統一 1.mysql5.7.17安裝在/usr/local/mysql目錄裏面,也可以安裝在其他地方 (安裝包最好與Linux系統一樣,eg;64位的就是“mysql-5.7.17-linux-glibc2.
CentsOS7無網情況下安裝mysql5.7
rman debug x86-64 https conda oot fma 支持 depend 1.需求就不用講了,客戶現場,政府環境,銀行環境,大多是沒網的,所以無網安裝是很有必要的 mysql下載路徑:https://dev.mysql.com/downloads/my
CentOS7下安裝mysql5.7
目錄 臨時 狀態 start 創建 usr style 修改密碼 lib 1、安裝YUM Repo 由於CentOS 的yum源中沒有mysql,需要到mysql的官網下載yum repo配置文件。 wget https://dev.mysql.com/get/my
centos6.4下安裝mysql5.7.18
https chmod stat groupadd grep 內容 nload inf c-c 1、安裝前工作 在安裝前需要確定現在這個系統有沒有 mysql,如果有那麽必須卸載(在 centos7 自帶的是 mariaDb 數據庫,所以第一步是卸載數據庫)。 卸載系統自帶
CentOS RPM 安裝 MySQL5.7
dem common -i libs reg pen monit rar moni 環境 CentOS 7 64位 MySQL 5.7 64位 1.卸載系統自帶的 mariadb [root@localhost /]# rpm -qa|grep mariadb mariad
如何在Centos7下安裝MySQL5.7
Centos7下安裝MySQL5.7Centos7下安裝MySQL5.7 在CentOS中默認安裝有MariaDB,這個是MySQL的分支,但為了需要,還是要在系統中安裝MySQL,而且安裝完成之後可以直接覆蓋掉MariaDB。 1、安裝mysql (由於yum源上沒有mysql-server。所以必須去官網
Centos7環境下安裝Mysql5.7版本
-o ins .com sbin 數據庫密碼 庫文件 用戶 sku mysql安裝 實驗環境: VMware Workstation12 Centos-7-x86_64系統(ip地址:192.168.5.132)(2G內存 2個處理器) 使用軟件:boost_1_59
WIN10下安裝MySQL5.7 Archive版
通過Archive包安裝使用MySQL方便而快捷,只需進行簡單幾步設定即可開始使用MySQL 下載MySQL https://dev.mysql.com/downloads/mysql/ 選擇windows 64位版下載,下載完成後解壓即可,此次下載檔案為mysql-5.7.19-