Jump to content

MySQL error connecting to database


foodie
Go to solution Solved by foodie,

Recommended Posts

 

Error which I get:

 

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'mysql11.000webhost.com' (111)' in /home/a5416708/public_html/blog/includes/config.php:11 Stack trace: #0 /home/a5416708/public_html/blog/includes/config.php(11): PDO->__construct('mysql:host=mysq...', 'a5416708_blog', '123asd') #1 /home/a5416708/public_html/blog/index.php(1): require('/home/a5416708/...') #2 {main} thrown in /home/a5416708/public_html/blog/includes/config.php on line 11

 

Code I have witch exports database:

define('DBHOST','mysql11.000webhost.com');
define('DBUSER','a5416708_blog');
define('DBPASS','123asd');
define('DBNAME','a5416708_blog');

$db = new PDO("mysql:host=".DBHOST.";port=8889;dbname=".DBNAME, DBUSER, DBPASS);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

My question is this - How do I fix this error?

Link to comment
Share on other sites

Thanks for help about port.

Have fixed that.

 

Once I go to my page I get this

 

 

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'a5416708_blog.blog_posts' doesn't exist

 

 

When I try to access Administrator Panel I get this error -

 

 

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'a5416708_blog.blog_members' doesn't exist

 

Next question is how do i fix this?

 

P.S I'm really noob in php/sql.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.