Access denied for user 'root'@'localhost' (using password: YES)
2个回答
展开全部
忘记mysql密码,使用不对的服务器密码,在连接服务器的时候,常常会提示 Access denied 错误,如下图所示:
[plain] view plaincopy
[root@localhost bin]# ./mysql -uroot -p12345
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
遇到上面情况怎么办,请按如下步骤操作:
1、停止mysql服务
[plain] view plaincopy
[root@localhost bin]# chkconfig --list | grep -i mysql
mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[root@localhost bin]# service mysql stop
Shutting down MySQL [确定]
2、用mysqld_safe重启服务
[plain] view plaincopy
[root@localhost bin]# ./mysqld_safe --user=root --skip-grant-tables --skip-networking &
[1] 3818
[root@localhost bin]# 111105 07:30:32 mysqld_safe Logging to '/usr/local/mysql/var/localhost.localdomain.err'.
111105 07:30:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
./mysql -uroot mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.48-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
3、重设密码
[plain] view plaincopy
mysql> update user set password=password('12345') where user='root' ;
Query OK, 3 rows affected (0.05 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
4、重启服务
[plain] view plaincopy
[root@localhost bin]#service mysql stop
[root@localhost bin]# service mysql start
5、再次连接数据库
[plain] view plaincopy
[root@localhost bin]# ./mysql -uroot -p12345
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.48-log Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
2015-07-25
展开全部
boolean tag = true;
final String pattern1 = "^([a-z0-9A-Z]+[-|//.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?//.)+[a-zA-Z]{2,}$";
final Pattern pattern = Pattern.compile(pattern1);
final Matcher mat = pattern.matcher(email);
if (!mat.find()) {
final String pattern1 = "^([a-z0-9A-Z]+[-|//.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?//.)+[a-zA-Z]{2,}$";
final Pattern pattern = Pattern.compile(pattern1);
final Matcher mat = pattern.matcher(email);
if (!mat.find()) {
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询