Questions tagged [mysql-connect]

The `mysql_connect` function opens a connection to a MySQL server.

The mysql_connect function opens a connection to a MySQL server. However, this function, along with all other mysql_* functions, are deprecated in PHP 5.5.0 and should be avoided (see the red box). Consider using prepared statements with either PDO or MySQLi instead.

192 questions
0
votes
1 answer

Access denied for user 'root'@'localhost' when password print on bash

I am using mysql 5.6 I want to connect mysql from bash. mysql -u root -pAdmin@1234 i am getting following error- Warning: Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user…
0
votes
1 answer

Why is pip install mysql-connector fail?

I'm just trying to simply install python-myconnector using the very simple instructions provided here. But it is failing. Here is the error I get: (my_virtual_env) [my.username@my_machine ~]$ pip install mysql-connector ... Command…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
0
votes
1 answer

How to improve MySQL connection time in PHP?

As testing performances on APIs, I found that 30% of response time for APIs are spent on connecting to MySQL. (Min. 500ms - Max. 600ms) I assumed that it was because of MySQL settings, so I changed various settings to improve the connection time,…
Hax0r
  • 1,722
  • 4
  • 25
  • 43
0
votes
2 answers

Mysql too many connection error

I think something wrong with this graph.. but i don't know what error is this.. I tried to increase max connection from 150 to 300, i still got the same error.. Any idea what happenned? Please help.. thx
Riky
  • 13
  • 4
0
votes
1 answer

Connect to mySQL over LAN

Hey all, i am having problems with connecting to a PC on my local LAN thats running the mySQL database. The code in VB6 i have is: .ConnectionString = "DRIVER={MySQL ODBC 5.1…
StealthRT
  • 10,108
  • 40
  • 183
  • 342
0
votes
1 answer

Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\wamp64\www\empresa\model\Model_user.php on line 21

My code is giving this error: Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\wamp64\www\empresa\model\Model_user.php on line 21 My classes are these: Connection.php
0
votes
3 answers

Keep database connection open through ajax calls

I'm creating a debugging module that will allow the user to make single-line ajax calls while they are actively watching how the page changes. The problem is if the user is trying to make database calls. The user can run the function…
jwegner
  • 7,043
  • 8
  • 34
  • 56
0
votes
3 answers

PHP - How to get mysqli_connect() to return a RESOURCE so it can be used with define()

I have noticed something while testing different MySQL connection methods in PHP. I usually use odbc_connect() when making a connection to a database in PHP. I save the resouce variable that odbc_connect() returns into a global constant (using the…
user3163495
  • 2,425
  • 2
  • 26
  • 43
0
votes
1 answer

Issue with MySQL connection inside class

I have a MySQL class that I use to connect to MySQL. But after doing the upgrade of PHP to 5.4.16, it doesn't work any more. Can anyone help with it? Below is the code that I use. Whenever I try to connect it gets into the error part. final class…
Gops
  • 129
  • 1
  • 5
0
votes
1 answer

Difference in execution time of a query between PHP and PHPMyAdmin

I found other posts about this, but I could not solve my problem. When I run a query by PHPMyAdmin, the query runs in 9 milliseconds Showing records 0-24 (35 total Query took 0.0009 sec) However, when you run the same query in the PHP server, the…
0
votes
1 answer

C++ terminate called after throwing an instance of 'std::length_error', what(): basic_string::_M_create

I am getting the following error when running under Ubuntu 16.04. C++ terminate called after throwing an instance of 'std::length_error', what(): basic_string::_M_create When I run under Ubuntu 15.04 the code runs fine. The gdb trace I have isolated…
Langerz
  • 71
  • 1
  • 5
0
votes
0 answers

mysql_connect working while mysqli_connect not

I know this question has been asked a few times here but still i wasn't able to find any answer that would actually help me. Since i read in documentation that mysql_connect is now deprecated i wanted to replace it with mysqli_connect. Original…
An Capone
  • 123
  • 2
  • 15
0
votes
1 answer

How to use try/catch exception in mysql database connect

I need to connect with database and don't need to show errors. i must use try/catch exception. class MySqlDatabase { private $connection; function __construct() { $this->open_connection(); } public function open_connection() { …
asty
  • 17
  • 5
0
votes
1 answer

mysql_query connection NULL result, but I've connection successfully

I've problem with mysql. I've PHP script, which returned array into json data from datebase. I've message from 'echo' about successfully connection, but my result is equals which null of array. In result on Explorer I've: Connected…
Remi
  • 19
  • 6
0
votes
0 answers

Any way to trace MySqlConnection to detect reasons for slow connection

I need to find some way in C# to trace the MySqlConnection.Open() methods connection to find out why it's taking over 15 seconds just to establish the connection. I.e to see some kind of connection log to find out whats holding it up. The code below…
DMcDonald
  • 89
  • 1
  • 14