mysql安装提示密码过期解决

mysql [email protected] -p
Enter password:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.

修改

vim /etc/my.cnf

datadir=/home/mysql/data

port = 3306
user = mysql
character_set_server=utf8

skip-grant-tables

/etc/my.cnf" 31L, 704C written
[[email protected] mysql]#
[[email protected] mysql]#
[[email protected] mysql]# service mysqld restart
Shutting down MySQL.. [ OK ]
Starting MySQL. [ OK ]
[[email protected] mysql]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]>
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)

MySQL [(none)]> 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 [mysql]>
MySQL [mysql]>
MySQL [mysql]> select * from mysql.user where user=‘root‘ \G
1. row
Host: localhost
User: root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
password_expired: Y
password_last_changed: 2018-06-29 11:42:11
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)

MySQL [mysql]> update user set password_expired=‘N‘ where user=‘root‘;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MySQL [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MySQL [mysql]> select * from mysql.user where user=‘root‘ \G
1. row
Host: localhost
User: root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9
password_expired: N
password_last_changed: 2018-06-29 11:42:11
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)

原文地址:http://blog.51cto.com/357712148/2134196

时间: 2024-10-18 03:35:03

mysql安装提示密码过期解决的相关文章

CentOs7下安装mysql5.7.14,初始化完成登录mysql提示密码过期

解决方法:1. 使用mysql的绝对路径登录,一般mysql的安装路径为/usr/local/mysql,则使用如下命令 /usr/local/mysql/bin/mysql -uroot -p'password' 2.cp /usr/local/mysql/bin/mysql /usr/bin/ mysql -uroot -p'password' 原因解释:安装CentOs的时候,默认安装了mysql,并且版本与自己安装的mysql版本不一致,直接使用mysql -uroot -p'passw

windows下mysql忘记root密码的解决办法

今天早上 一朋友说自己的mysql 忘记root密码了 让我帮忙给看看,因为没有接触过mysql 所以从网上找了一下信息经我亲身实践  已经成功!mysql版本是5.1以下是从网上找的信息: 1. 首先检查mysql服务是否启动,若已启动则先将其停止服务,可在开始菜单的运行,使用命令: net stop mysql 打开第一个cmd1窗口,切换到mysql的bin目录,运行命令: mysqld --defaults-file="C:\Program Files\MySQL\MySQL Serve

oracle账号密码过期解决方法

oracle system账号密码过期解决方法. system账号的密码默认有效期为180天,当密码提示已经过期后, 可以用以下方法解决: 1>在DOS窗口输入 sqlplus ,提示输入账号密码 2>输入system的账号密码,会提示"密码已经过期,请重新设置新密码" 3>输入新密码即可<如果不想改密码可以输入原来的密码>.

Centos下忘记mysql的root密码的解决方法

Centos下忘记mysql的root密码的解决方法 一:(停掉正在运行的mysql) [[email protected] ~]# service mysql stop 二:使用 “--skip-grant-tables”参数重新启动mysql [[email protected] ~]# mysqld_safe --skip-grant-tables & [1] 23810 Starting mysqld daemon with databases from /var/lib/mysql 三

提示密码过期错误

提示密码过期错误:ORA-28001: the password has expired 查询默认的profile的密码过期的设置 select * from dba_profiles where profile='DEFAULT' and resource_name='PASSWORD_LIFE_TIME'; 设置default profile密码永不过期,立即生效,不需重启 alter profile default limit password_life_time unlimited; 已

windows下mysql安装失败的一个解决案例

操作系统:windows8.1,之前安装过mysql,这次安装在配置的最后一部执行“Apply security settings”的过程中弹出经典错误: Access denied for user 'root'@'localhost' (using password:YES) 网上寻找了各种方法,有:原mysql未卸载完全的,失败:有修改密码的,解决方法如下: 解决办法是重新设置root用户密码,在Windows平台下操作步骤如下:1.以系统管理员身份登录到系统:2.如果MySQL服务器正在

【转】mysql忘记root密码的解决方法

本文收集于本人的笔记本,由于找不到原文出处.在此省略,如哪位知道可以联系我加上. 方法一:在windows下:1.打开命令行(DOS)窗口,停止mysql服务: net stop mysql 2.在DOS下面进入mysql的安装路径下的 bin目录,如 D:\mysql\bin 3. 输入并执行命令: mysqld-nt --skip-grant-tables (此命令执行后该窗口就停住了) 4.另外打开一个命令行窗口,执行mysql >use mysql >update user set p

MySQL安装及中文乱码解决

MySQL安装 终端输入 sudo apt-get install mysql-server 启动和关闭mysql服务器 service mysql start service mysql stop 进入mysql shell界面 mysql -u root -p 在Ubuntu18.04第一次安装mysql进入Shell时,需要设置密码 sudo cat /etc/mysql/debian.cnf 得到一系列信息: user password 用mysql -u debian-sys-main

windows下mysql忘记root密码的解决方法

方法一: 1.在DOS窗口下输入net stop mysql5 或 net stop mysql 2.开一个DOS窗口,这个需要切换到mysql的bin目录.一般在bin目录里面创建一个批处理1.bat,内容是cmd.exe运行一下即可就切换到当前目录,然后输入mysqld-nt --skip-grant-tables; 3.再开一个DOS窗口,mysql -u root 4.输入: 复制代码代码如下: use mysql update user set password=password("n