foodie Posted January 2, 2016 Share Posted January 2, 2016 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? Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/ Share on other sites More sharing options...
doni49 Posted January 2, 2016 Share Posted January 2, 2016 http://stackoverflow.com/a/23532364/1042053 Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/#findComment-1528992 Share on other sites More sharing options...
foodie Posted January 2, 2016 Author Share Posted January 2, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/#findComment-1528994 Share on other sites More sharing options...
benanamen Posted January 2, 2016 Share Posted January 2, 2016 (edited) It means exactly what it says. There is no table with that name. Replace that with a table name that exists or create a new table. Try blog_members Edited January 2, 2016 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/#findComment-1528995 Share on other sites More sharing options...
foodie Posted January 2, 2016 Author Share Posted January 2, 2016 Yeah, i figured that table dosent exist. It means I didnt explain myself fully. Question remains - how to create thoses tables witch my blog script needs Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/#findComment-1528997 Share on other sites More sharing options...
Solution foodie Posted January 2, 2016 Author Solution Share Posted January 2, 2016 Nevermind, solved! Quote Link to comment https://forums.phpfreaks.com/topic/300106-mysql-error-connecting-to-database/#findComment-1529013 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.