Solved

PHP PDO Fatal Error

Posted on 2015-01-26
4
361 Views
Last Modified: 2015-01-27
Hi E's,
I try to access to data base using PDO, but any code that I try always give me this fatal error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file' in /home/pedro/public_html/biblioteca/tutoriais/1243/novo_teste.php:4 Stack trace: #0 /home/pedro/public_html/biblioteca/tutoriais/1243/novo_teste.php(4): PDO->__construct('mysql:host=loca...', 'xxxxxxxxxxxxxx', 'xxxxxxxxxxxx') #1 {main} thrown in /home/pedro/public_html/biblioteca/tutoriais/1243/novo_teste.php on line 4

Open in new window

My last try was:
 <?
$conn = new PDO(
    'mysql:host=localhost;dbname=xxxxxxxxxxx', 'xxxxxxxxxxx', 'xxxxxxxxxxxxxxx'
);
?> 

Open in new window

What do I have to do to stop this error?

The best regards, JC
0
Comment
Question by:Pedro Chagas
  • 2
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 40571514
Do you have access to the server via a command line?  Possibly ssh access?

If so, use the mysql command line utility.

mysql -u <username -p

You'll be prompted for your password.

Then enter the command in the error message.
SET PASSWORD = PASSWORD('your_existing_password')
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40571525
Hi @Daniel Wilson thank you,
I have a VPS, I thing I have access to the command line, but if not, I ask to the support for they do that for me.
Just one question, this will affect only one domain, or all my VPS (Virtual Private Server) domains?

~JC
0
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 40571539
This will affect anything that uses that same username / password on the same MySql server.

In all likelihood, the access methods any other sites you are running will support the hashed password.  But ... without knowing those details I wouldn't promise it.
0
 
LVL 3

Author Comment

by:Pedro Chagas
ID: 40571623
Hi again, I send a request to the VPS support, and I give you feedback soon.
Thank you.

~JC
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now