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

Issues connecting to mysql, random database connection errors,

I'm currently hosting a Wordpress site on windows azure and keep getting random connect issues. Warning: mysql_connect(): An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue…
TheNickyYo
  • 2,389
  • 5
  • 20
  • 28
0
votes
1 answer

Lua programming ,error in establishing Database connection

After writing the code to connect to database,lua returns an error as Error in establishing connection to MySQL ,Can't connect to /var/lib/mysql/mysql.sock I'm unable to locate the /var/lib/mysql/mysql.sock file (which I haven't created ) My Sock…
user3743558
0
votes
2 answers

PHP Prevent multiple MySQL Connections

I have a large procedural style php/mysql website, which is splitted into many different files. Within each file, i include my dbconn.php, to ensure, that a db connection is available. It looks something likes this: index.php
user3614800
  • 73
  • 1
  • 8
0
votes
4 answers

Connecting web page to database using PHP gives strange results

I have a Raspberry Pi web server set up at home and I have phpMyAdmin set up to administer databases. I have created a database to hold bits of information which will be used to place markers on a Google map (multiple users will be adding markers of…
user3535074
  • 1,268
  • 8
  • 26
  • 48
0
votes
1 answer

Unable to connect to existing MySQL database

I have a database, I can see it with phpMyAdmin. But when I try to connect in my C program it fail and mysql_error only return : Unknown database 'database-name' There is no spelling mistake so why doesn't it work ? EDIT : here is the code used…
Aleksandair
  • 167
  • 1
  • 2
  • 11
0
votes
0 answers

How to connect to another mysql server using mysql_connect

is it possible to connect to another mysql server using mysql_connect function? this is my code $dbHost = "192.168.1.2:3306"; $dbUser = "root"; $dbPass = "pass"; $con = mysql_connect($dbHost, $dbUser, $dbPass); and i got this mysql error Warning:…
Adrian C.
  • 19
  • 1
  • 1
  • 6
0
votes
1 answer

Avoid database calls using incorrect database connection

I'm working on some large software that has a current database connection open that connects to one database, but unfortunately it doesn't use the link identifier in it's query calls. Now I had to open a connection to another database; this works…
Brett
  • 19,449
  • 54
  • 157
  • 290
0
votes
2 answers

Where to Close MySQL Connection on PHP

I'm newbie at PHP & MySQL and I've a question about mysql_connect and mysql_close Here is my code (functions.php): $link = mysql_connect("localhost","root","") or die("error"); mysql_select_db("dbName",$link) or die("error 2"); mysql_query("SET…
Degauser
  • 120
  • 1
  • 2
  • 9
0
votes
0 answers

MAMP PHP MYSQL query white screen? OSX

I'm trying to test a piece of code but all I get is a white screen I don't know why :S here it is:
sol_keys
  • 13
  • 5
0
votes
4 answers

Having Trouble Connecting to MySQL Database

The following code successfully connects me to my mySQL database. $conn = mysql_connect("localhost", "root", "") or die("Failed to Connect!"); $db = mysql_select_db("MyDB"); I have been experimenting on localhost using XAMPP and phpmyadmin, and…
user3055501
  • 315
  • 2
  • 5
  • 7
0
votes
0 answers

Passing Array Values to Mysqli_connect

I am reading the values from a text file that hold the connect parameters to connect to Mysql Server. The content of the file is: localhost user password databaseName I read the file and put the file and out the values into an array. I then try to…
DSly
  • 26
  • 3
0
votes
1 answer

User already has more than 'max_user_connections' active connections

I have one shared hosting account and i am running dynamic site there. i am facing below problem sometime where database record returns. Warning: mysql_connect() [function.mysql-connect]: User myuser already has more than 'max_user_connections'…
RanaHaroon
  • 445
  • 6
  • 20
0
votes
1 answer

Persistent DB Connections aren't Getting Reused

I am using phpgacl library in one of my applications for authorization. This library is making connections to the database using mysql_pconnect. The problem is that the connections aren't getting reused and at times the whole application crashes…
azi
  • 929
  • 1
  • 11
  • 31
0
votes
1 answer

Connection issue with mysqli

$db= mysqli_connect('localhost', "root", "root"); if(!$db) die("Error connecting to MySQL database."); mysqli_select_db("onlineform", $db); As I try to connect to the database like shown above, I am getting the following error:…
John Smith
  • 11
  • 3
0
votes
1 answer

Java mysql connection is error

I tried connect mysql in java but there is compiler error. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use…