Any one plz tell me why i am getting this error ?? firstly my internet connection was good today its not good so i am getting this error.how can i fix this any idea plz??
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] A
connection attempt failed because the connected party did not properly respond after a
period of time, or established connection failed because connected host has failed to
respond. ' in D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php:129
Stack trace: #0 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php(129):
PDO->__construct('mysql:host=192....', 'root', 'root', Array) #1 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Mysql.php(109):
Zend_Db_Adapter_Pdo_Abstract->_connect() #2 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(860):
Zend_Db_Adapter_Pdo_Mysql->_connect() #3 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Abstract.php(930):
Zend_Db_Adapter_Abstract->quote('testing', NULL) #4 D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Auth\Adapter\DbTable.php(449): Zen
in D:\SVN
data\WebClient_PHP\trunk\p\library\Zend\Db\Adapter\Pdo\Abstract.php on line
144
this is my config.ini
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
some code from my index.php
$config = new Zend_Config_Ini(ROOT_DIR.'/application/config.ini', 'general');
$DB = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($DB);
it seems that your code this portion is not working
[general]
db.adapter = PDO_MYSQL
db.params.host = 192.168.0.233
db.params.username = root
db.params.password = my_password
db.params.dbname = "mydatabasename"
either the IP is not correct if so go to cmd in windows and type ipconfig you will get your correct ip paste it here OR just simply write
db.params.host = localhost
if and only if you are using locally may be it works.
for the hostname/host try to use your credentials found in the Zend Server -> PHP Cloud tab -> Overview page -> User Parameters tab... then make the "host" part in the credentials like this:
[general]
db.adapter = PDO_MYSQL
db.params.host = CONTAINERNAME-db.my.phpcloud.com
db.params.username = ZEND_DB_USERNAME
db.params.password = ZEND_DB_USERNAME
db.params.dbname = ZEND_DB_DBNAME
Did you check your mysql database is up?
If you are sure it is, check that your adapters configuration is ok, maybe the host parameter is not properly configured.
Related
I am trying to setup DVWA and I did all the steps according to this video (https://www.youtube.com/watch?v=cak2lQvBRAo) till renaming the config file to config.nic.php and changing the password field to blank.
Something like this-
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = '';
$_DVWA[ 'db_port'] = '3306';
I get the error on this page (http://127.0.0.1/login.php)-
Fatal error: Uncaught mysqli_sql_exception: Unknown database 'dvwa' in C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php:499
Stack trace:
#0 C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php(499): mysqli_query(Object(mysqli), 'USE dvwa')
#1 C:\xampp\htdocs\login.php(8): dvwaDatabaseConnect()
#2 {main}
thrown in C:\xampp\htdocs\dvwa\includes\dvwaPage.inc.php on line 499
Can't even access the DVWA setup. I am using XAMPP and the Apache2 (ports 80, 443) and mySQL (port 3306) are running fine. Please help!
Got the answer for you.
Try localhost/dvwa/setup.php on browser
Then click on create or reset database and it should get to login page
Remember user name and password must be same as what you configured in config.php
Good luck
I have some troubles in setting up a connection with my VPS with the library mysql1 on flutter. I get this error Unhandled Exception: Error 1156 (08S01): Got packets out of order when I perform a query.
MySQL server version: 8.0.28
This is my service in which I perform the connection with my database.
var settings = ConnectionSettings(
host: 'MY_ADDRESS',
port: 3306,
user: 'root',
password: 'MY_PASSWORD',
db: 'MY_DATABASE'
);
Future connect() async {
return await MySqlConnection.connect(settings);
}
And then I try to retrieve users information in another method in this way:
var connection = await mysqlService.connect();
var res = await connection.query('select name from users');
await connection.close();
The problem is in the connection.query function which generate the error:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Error 1156 (08S01): Got packets out of order
#0 Handler.checkResponse
package:mysql1/…/handlers/handler.dart:77
#1 QueryStreamHandler.processResponse
package:mysql1/…/query/query_stream_handler.dart:50
#2 ReqRespConnection._handleData
package:mysql1/src/single_connection.dart:349
#3 ReqRespConnection._handleHeader
package:mysql1/src/single_connection.dart:318
<asynchronous suspension>
#4 ReqRespConnection._readPacket
package:mysql1/src/single_connection.dart:303
<asynchronous suspension>
I Am not sure if it is a problem with the database that I have on my VPS or is something else.
This package appears to have problems with MySQL 8.
Try to use mysql_client, this one helped me.
https://pub.dev/packages/mysql_client
I need to establish an SSL connection between MySQL server and PHP web application.
Currently we are working with offline server (wampserver) and we need to establish an SSL connection. Th moment I changed the connection script from:
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8mb4");
To:
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass, array(
PDO::MYSQL_ATTR_SSL_KEY =>'/etc/mysql/ssl/client-key.pem',
PDO::MYSQL_ATTR_SSL_CERT=>'/etc/mysql/ssl/client-cert.pem',
PDO::MYSQL_ATTR_SSL_CA =>'/etc/mysql/ssl/ca-cert.pem'
));
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->exec("SET CHARACTER SET utf8mb4");
an error appeared on the login page saying:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2006] MySQL server has gone away' in C:\wamp64\www\
EDIT
I run this query:
show variables like '%ssl%'
And got the following result:
I'm trying to set up an application using the Zend Framework but the problem i'm getting is as soon as i add the following line in the application.ini the default home page that is created by the zend tool throws a fatal error
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message 'Configuration array must have a key for 'password' for login
credentials' in C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php:295
Stack trace: #0 C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php(183):
Zend_Db_Adapter_Abstract->_checkRequiredOptions(Array) #1
C:\xampp\php\PEAR\Zend\Db.php(270):
Zend_Db_Adapter_Abstract->__construct(Array) #2
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(142):
Zend_Db::factory('PDO_MYSQL', Array) #3
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(154):
Zend_Application_Resource_Db->getDbAdapter() #4
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(683):
Zend_Application_Resource_Db->init() #5
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('db')
6 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #7
C:\xampp\php\PEAR\Zend\Ap in
C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php on line 295
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.dbname = codenamesnm
i'm using xampp with windows 7 Any idea what is wrong
Do not omit these lines:
resources.db.params.username = rob
resources.db.params.password = 123456
set them to "root" or "" if necessary, but let them into your application.ini.
I have the next code in a js file:
var mysql = require('mysql');
var TEST_DATABASE = 'nodejs_mysql_test';
var TEST_TABLE = 'test';
var client = mysql.createClient({
user: 'root',
password: 'root',
});
client.query('CREATE DATABASE '+TEST_DATABASE, function(err) {
if (err && err.number != mysql.ERROR_DB_CREATE_EXISTS) {
throw err;
}
});
But I get this error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: connect ECONNREFUSED
at errnoException (net.js:632:11)
at Object.afterConnect [as oncomplete] (net.js:623:18)
As I understand it, this is a connection problem - but how do I solve it?
( I'm working on windows 7)
Thanks!!
I know two ways to solve it:
In mysql.conf, comment skip-networking.
Try to set the socket like this:
var client = mysql.createClient({
user: uuuu,
password: pppp,
host: '127.0.0.1',
port: '3306',
_socket: '/var/run/mysqld/mysqld.sock',});
I got this error when MySQL Server was not running.
I changed my configuration via Initialize Database in MySQL.PrefPane, the System Preferences tool for MySQL on OS X - to Use Legacy Password Encryption - to fix ER_NOT_SUPPORTED_AUTH_MODE.
This config change stopped MySQL Server and then I got ECONNREFUSED when I tried to connect to MySQL from node.js.
Fixed by restarting MySQL Server from the MySQL System Preferences tool.
Try to fix your defined port in mysql and your Node.js script.
You can define the mysqld port in the *.cnf file inside the mysql directory,
and you can define that port when you connect to MySQL in your Node.js script.
Something like this in the cnf file
port = 3306