【札記】Linux下 MySQL-5.7.17 tar.gz 包方式安裝部署後出現密碼過期的問題解決(不修改/etc/my.cnf檔案)
在Oracle linux 6.8上安裝完成MySQL-5.7.17(使用版本為:mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz)後:
[[email protected] ~]# mysql --version
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
# service mysqld start
命令列啟動正常,登入出現問題:
[[email protected] ~]# mysql -uroot -p
Enter password:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
根據提示:密碼過期,必須使用一個mysql客戶端登入修改密碼後才能使用。
mysql的提示與日誌提示都是比較模糊的,只能根據經驗進行問題排查。
【解決方法】
使用以下方式解決:
1、關閉mysql服務
[[email protected]shh ~]# service mysqld status
MySQL running (30500)[ OK ]
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# service mysqld stop
Shutting down MySQL..[ OK ]
[[email protected] ~]#
2、進入mysql的工作目錄 /usr/local/mysql/bin 使用mysql安全模式啟動mysql,跳過mysql的登入許可權驗證
[[email protected] ~]# cd /usr/local//mysql/bin/
[[email protected] bin]# ./mysqld_safe --skip-grant-tables &
[1] 1557
[[email protected] bin]# 2017-10-11T01:35:35.836730Z mysqld_safe Logging to '/usr/local/mysql/data/shhy-dw-application.err'.
2017-10-11T01:35:35.840516Z mysqld_safe Logging to '/usr/local/mysql/data/shhy-dw-application.err'.
2017-10-11T01:35:35.868903Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
執行完命令後,mysql會自動安全模式重啟(注意:切記此時不要在再此shell視窗進行任何操作),此時,則新開ssh視窗或者使用遠端機器(已安裝MySQL客戶端的Windows)的命令列進行連線訪問:
3、命令列連線mysql資料庫。此時無需指定密碼。
[[email protected] ~]# mysql -h10.10.9.35 -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select user,host,authentication_string,password_expired from mysql.user;
+-----------+-----------+-------------------------------------------+------------------+
| user | host | authentication_string | password_expired |
+-----------+-----------+-------------------------------------------+------------------+
| root | localhost | *895A2D9FF0E9EFA56E84678045BB050034435B72 | Y |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N |
+-----------+-----------+-------------------------------------------+------------------+
2 rows in set (0.00 sec)
mysql> update user set authentication_string=password('admin321') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> update user set password_expired='N' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> update user set host='%' where user=root;
ERROR 1054 (42S22): Unknown column 'root' in 'where clause'
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select user,host,authentication_string,password_expired from mysql.user;
+-----------+-----------+-------------------------------------------+------------------+
| user | host | authentication_string | password_expired |
+-----------+-----------+-------------------------------------------+------------------+
| root | % | *2A29AD291780ABA691DA40E5900F63BCD40CB849 | N |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N |
+-----------+-----------+-------------------------------------------+------------------+
2 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
4、如需要可永久關閉mysql密碼過期功能限制:
修改全域性配置檔案 /etc/my.cnf 或者 /usr/local/mysql/support-files/my-default.cnf 檔案(最後同時加上)
如下(如有則直接修改):
[mysqld]
default_password_lifetime=0
5、關閉當前使用安全MySQL模式的服務,直接kill -9 解決
^C
[[email protected] bin]#
[[email protected] bin]#
[[email protected] bin]#
[[email protected] bin]# ps -ef|grep mysql
root 1557 1437 0 09:35 pts/1 00:00:00 /bin/sh ./mysqld_safe --skip-grant-tables
mysql 1643 1557 0 09:35 pts/1 00:00:02 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --skip-grant-tables --log-error=/usr/local/mysql/data/shhy-dw-application.err --pid-file=/usr/local/mysql/data/shhy-dw-application.pid
root 1743 1719 0 09:51 pts/0 00:00:00 mysql -h10.10.9.35 -uroot
root 1953 1437 0 10:45 pts/1 00:00:00 grep mysql
[[email protected] bin]# kill -9 1557
[[email protected] bin]# kill -9 1643
[1]+ Killed ./mysqld_safe --skip-grant-tables
[[email protected] bin]# ps -ef|grep mysql
root 1743 1719 0 09:51 pts/0 00:00:00 mysql -h10.10.9.35 -uroot
root 1956 1437 0 10:46 pts/1 00:00:00 grep mysql
重啟服務,即可使用修改後的密碼admin321進行訪問了。
[[email protected] bin]# service mysqld status
MySQL is not running, but PID file exists[FAILED]
[[email protected] bin]# service mysqld start
Starting MySQL[ OK ]
[[email protected] bin]# ps -ef|grep mysql
root 1997 1 0 10:48 pts/1 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/shhy-dw-application.pid
mysql 2099 1997 5 10:48 pts/1 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/shhy-dw-application.err --pid-file=/usr/local/mysql/data/shhy-dw-application.pid
root 2131 1437 0 10:48 pts/1 00:00:00 grep mysql
[[email protected] bin]#
[[email protected] bin]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.17 MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
相關推薦
【札記】Linux下 MySQL-5.7.17 tar.gz 包方式安裝部署後出現密碼過期的問題解決(不修改/etc/my.cnf檔案)
【問題描述】 在Oracle linux 6.8上安裝完成MySQL-5.7.17(使用版本為:mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz)後: [[email protected] ~]# mysql --version mysql Ver 14.14 D
關於linux-Centos 7下mysql 5.7.9的rpm包的安裝方式
mysql 5.7.9的rpm包的安裝方環境介紹>>>>>>>>>>>>>>>>>>操作系統:Centos 7.1mysql數據庫版本:mysql5.7.9mysql官方網站:http://www.my
Linux安裝mysql-5.7.17.tar.gz
1.建立mysql組和mysql使用者 groupadd mysql useradd -r -g mysql mysql 2.拷貝: cp -R mysql-5.7.16-linux-glibc2
Linux下mysql-5.7.20安裝
版本 symbol 問題 init temporary rar files sans AS 1 參考文檔 https://dev.mysql.com/doc/refman/5.7/en/source-installation.html https://dev.mysql.c
Linux下MySQL 5.7.23無法遠端連線解決方案
MySQL 版本:5.7.23作業系統:Linux問題描述:只能通過Linux系統賬號Root命令列進入資料庫,無法使用JDBC,遠端連線工具進入資料庫。報錯:ERROR 1698 (28000): Access denied for user 'root'@'localhost'這個問題明顯就是沒有開放遠端
Linux下MySQL 5.7的初始化
要用管理員賬號執行。 systemctl start mysql#啟動MySQL服務 mysqld_safe --user=mysql &#啟動MySQL服務(安全方式) mysql -u root -p#登入MySQL(有密碼) mysql -u root#登入MySQL(無密碼) 成功進
linux下安裝mysql-5.7.16(tar.gz)
1、解壓mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz,並拷貝到/usr/local/mysql目錄下 解壓: tar -zxvf mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz
linux下 mysql 5.7 配置 my.cnf(mysqld.cnf)檔案位置 以及具體的配置方式
一、問題 mysql 5.7 版本,/etc/my.cnf 和 /etc/mysql/my.cnf 空空如也,需要自己新增需要的配置,而不能像之前一樣 只要去掉 #號註釋即可。 可以參考djCode的blogMySQL的my.cnf檔案(解決5.7.18下沒有my-d
linux下mysql 5.7.21 安裝
# tar -zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz 解壓 # mv mysql-5.7.21-linux-glibc2.12-x86_64 mysql 重新命名 # c
linux 下mysql 5.7.9tar 包安裝
1、軟體下載 登入到 http://dev.mysql.com/downloads/mysql/ ,選擇對應的版本進行下載。 2、建立mysql 使用者 [[email protected] ~]# groupadd mysql [[email
windows下mysql 5.7.24 的下載步驟和安裝配置方法圖文詳解
windows 下安裝mysql,供大家參考,具體內容如下 1.先下載好 mysql5.7.24 版本的安裝包,可以去mysql https://www.mysql.com/downloads/ 官網自己下載. 1.1
Linux下Mysql 5.6.30 tar包安裝實踐
環境:centos 6.5 x64 再選擇 下載完畢後,得到安裝包 mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 此包不再需要make編譯原始碼(真是扛扛的),之前的mysql-5.6.4.tar.gz包是原始碼包,需要先cmake
linux CenterOS 下 mysql-5.6.26.tar.gz原始碼安裝
1.準備工作 [[email protected]]# cd /cnpc/ 百度雲盤 mysql-5.6.26.tar.gz連結:http://pan.baidu.com/s/1dDe9ifv 密碼:ifus [[email protected] cn
linux 安裝mysql-5.7.19.tar.gz
1.給安裝包賦權chomd 755 mysql*****.tar.gz2.解壓安裝包tar -zxvf mysql*****.tar.gz3.為centos新增mysql使用者組和mysql使用者 groupadd mysql useradd -r -g mysql -s
Linux下Mysql 5.6.21 tar包安裝實踐
好久沒玩linux,由於專案需要部署新的linux開發環境,包括安裝jdk,tomcat,redis,mysql,趁著有時間,趕緊部署好。jdk,tomcat,redis很快就部署好了,唯獨mysql讓我折騰了一陣。先安裝了我之前就安裝過的原始碼版mysql-5.6.4,後
mysql-5.7.17-winx64解壓版本安裝圖解附常見問題
刷新 databases 編輯 總結 跳過密碼驗證 解決 配置 更改密碼 目錄 前言:自己搜索總結的一個文檔,包含了一些常見的問題(在文檔尾部)以便於下次使用 步驟如下: 第一步:下載mysql-5.7.17-winx64解壓版本:http://dev.mysql.com/
CentOS 7 安裝 MySQL 5.6.4 -- 通過二進位制包方式安裝
一、檢視系統已經安裝的mysql資料庫 1.檢視系統是否已經安裝了 mariadb [[email protected] ~]$ rpm -qa |grep mariadb mariadb-libs-5.5.52-1.el7.x86_64 2.檢視是否已經存在配置檔案 m
CentOS 7中基於rpm包方式安裝部署apm(php-fpm) + xcache
基於rpm包方式安裝部署apmCentOS 7, 基於rpm包方式安裝部署apm(php-fpm) + xcache;a) httpd, php, mariadb分別部署在一個單獨的主機上;b) 一個虛擬主機提供phpMyAdmin,另一個虛擬主機提供wordpress;c) 為phpMyAdmim提供htt
Linux下通用二進制安裝包安裝MySQL-5.7.17
二進制安裝包安裝MySQL5.7解壓拷貝mv mysql-5.7.14-linux-glibc2.5-i686 /usr/local/mysql先創建mysql用戶groupadd mysql useradd -r -g mysql -s /bin/false mysql創建mysql的數據目錄,該目錄在初始
【轉載】Anaconda2下的Python2 7和Python3 5的共存
Anaconda 本質上是一個軟體發行版,包含了 conda、Python 等 180 多個科學包及其依賴項。 因為包含了大量的科學包,Anaconda 的下載檔案比較大(約 500 MB),如果只需要某些包,或者需要節省頻寬或儲存空間,也可以使用Miniconda這個較小的發行版(僅包含conda和 Pyt