`
cloudtech
  • 浏览: 4605656 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

解决: Access denied for user 'mantis'@'localhost' (using password: YES)

 
阅读更多

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:PunctuationKerning /> <w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:Compatibility> <w:SpaceForUL /> <w:BalanceSingleByteDoubleByteWidth /> <w:DoNotLeaveBackslashAlone /> <w:ULTrailSpace /> <w:DoNotExpandShiftReturn /> <w:AdjustLineHeightInTable /> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:UseFELayout /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" LatentStyleCount="156"> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]> <mce:style><! /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} --> <!--[endif]-->

今天打开mantis,竟然出错了:

连接至数据库服务器失败;数据库返回的错误信息是:#1045: Access denied for user 'mantis'@'localhost' (using password: YES)

在网上找一下,好像是说用户名和密码不对。

打开Mantis的配置文件config_inc.php,内容如下:

那么就要确定密码是否正确。在网上找一篇文说如何改密码《如何为用户设置密码(MYSQL)》如下:

http://www.bitscn.com/mysql/art/200709/114164.html

原文如下:

当初次在机器上安装完Mysql,你可以匿名进行访问数据库或者以不带口令的root身份进入数据库.另外如果你是一个管理员,你还要进行一些用户的建立及授权,这又涉及到设置密码的问题.下面我们就讨论一下如何设置密码: ?<!--[if !supportFootnotes]-->[1]<!--[endif]-->E/a?PB
B~p![q]3
首先我们应该知道Mysql数据库中的口令存储必须用password()函数加密它.因为在user表中是以加密形式存储口令,而不是作为纯文本.如果你没有加密,直接在数据库中执行以下语句: <DtS
zAXih7&WK
use mysql
D22PGY>Rp
insert into user (host,user,password) values('%','user_name','your password');
W0LownKr
flush privileges;
*IaB8CxV

网管网bitsCN_com


B)d~Ne+
信结果不会让你满意.因为服务器比较的是加密的值,所以服务器连接一定失败.这里需要说明的是flush privileges;这条命令起到了重新加载授权表.你也可以在shell下直接用mysqladmin -u root reload或者mysqladmin -u root flush-privileges来实现重载授权表. YX9C4D}|~
4"/x9C,
Mysql环境下,你可以使用以下语句进行设置密码: ssWFY1wx{q
ZQ{tHT'n]X
1.insert into user(host,user,password) values('%','user_name',password("your password");
^_UP>w2v;
gu$`ESsy
2.set password for user_name = password("your password")
PYrJ 3cj

中国网管联盟www.bitscn.com


以上两种方法都必须进行重载授权表. $?dAs
.wR E<!--[if !supportFootnotes]-->
<!--[endif]-->
T

3.
当然你也可以在创建一个用户时直接设置密码,grant语句将为你自动加密口令. ^$A3RT0p
:grant all on *.* to user_name@% identified by "your password"; /HKSW
另外你也可以在shell环境下用mysqladmin程序来设置密码 pN/:5N(/r
: mysqladmin -u root password "your password"

把密码改了,还是不对,原来没有使用PASSWORD函数,再改一下:

update user set password=password("root") where user="administrator";

这次出现了另外一个问题:

连接至数据库服务器失败;数据库返回的错误信息是:#1044: Access denied for user 'mantis'@'localhost' to database 'mantis'

似乎数据库’mantis’找不到了。我在concole连接mysql server,也看不到数据库。难道数据库给重启时冲没了。怎样想都不对,感觉是运行错了数据库版本,再试试:

locate mysqld_safe

果然有两个版本,而/etc/init.d/mysql是错误的版本。执行“/var/lib/mysql/bin/mysqld_safe”,mantis终于又连上了。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics