Jul 4, 2009

MySQL Database Problems

free web hosting
Free Web Hosting > Computers & Tech > Databases

MySQL Database Problems

nakulgupta
My friends have a little forum running here. The problem is that quite often we get the following message when we try to open the page:

QUOTE
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 48

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331
phpBB : Critical Error

Could not connect to the database


Why does this happen and what can we do to avoid it??

Comment/Reply (w/o sign-up)

kaputnik
Hey.. smile.gif

I've often had that problem.. most often than not .. its because of incomplete transfers of files due to lost packets while you FTP. As a solution to this, I do the following:

1. re-upload the concerned file causing the problem as dictated by the error message (preferably re-upload the entire folder)
2. Check all files for consistancy with the files on your local system. I do this using the Compare Directories function in LeechFTP although I do all my file transfers using WSFTP.
3. Check and recheck your config files to make sure you've got all the settings correct. Especially the settings that connect you to the DB.

Usually, these steps should get you up and running. if it doesn't, then you may have a problem with your DB.. To cure any problems with that.. I'd suggest you Backup the tables with user data, as well as post data and dump your entire DB, drop all tables in your DB, run the SQL file that came with your installation of bb. .. and then re-populate the tables as required with all the user and post data... (DO all this only if you feel you've exhausted all other solutions, and feel compitent to do it)

Hope this helped.. smile.gif

Rashid

 

 

 


Comment/Reply (w/o sign-up)

Trekkie101
^Never heard that one.

As far as I was taught that means MySQL overloaded and is now broken, give it some time for the admin to reset it.

Comment/Reply (w/o sign-up)

NilsC
when it has the error on a line like that it can be the script or permissions als. Did you get any other error messages?

Nils

Comment/Reply (w/o sign-up)

Muddyboy
Maybe this will help
http://www.tech-recipes.com/mysql_tips762.html

From the looks of it, you need the help of a website admin to fix it smile.gif

Comment/Reply (w/o sign-up)

vhortex
QUOTE (nakulgupta @ Mar 25 2005, 07:58 PM)
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 48

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331
phpBB : Critical Error

Could not connect to the database
*


This is a server side error which only the webserver admin can correct.

mySQL servers have limited connections capability as of version 3.x, the max user can be atmost 100 connections.. at mySQL version 4.x, the connection goes up to 500 - 1000 connections as far as the last release I have on my pc.

Connection limit is base on the maximum current connections the server can handle.

Most of the time, mySQL server can process each query at a microsecond speed but there arise the question why some webservers encounter the error above.

1. First is that when mySQL server is accessed on the internet, there are countless of visitor that can access the website at any given time giving way to hammering and filling up all the connection slots to the servers.

2. Shared webserver hostings with shared connection poll will also trigger this event since assuming that there are 100 hosted sites sharing the same mySQL server with the same connection limit. If all 100 websites have 1 visitor at the exact time and 1 new visitor visits the same site at the same exact time, one of them will get that socket error if the max connection limit is 100.

3. There are times that we make scripts that connect to the database that are malformed. Malformed since they lack the full cycle of connection to the server. The full cycle is

a) locate server
cool.gif connect and open connection
c) process query
d) disconnect and close connections

sometimes, we forget the closing part or we have a database connection command that are unreachable to the scripts.

Unclose connections stayed up in the server. For us the connection is finished but for the server, it will dutifully waits for the the client softwares or programs to send their disconnect commands.

For every unclose connection, a connection slot is taken and on default installation, the autotimeout of the database sometimes is set to 45mins.


--------------

Hope i solve the problem, the best solution is to contact the server admin for some assistance since mostly the settings are beyond your control.

geez, this seems so long, maybe I should put this one as a tutorial laugh.gif

Comment/Reply (w/o sign-up)

emersonbrum
It looks a problem in your code. You sould take a look there to fix it up.

The fist line is telling you that there is problem in your code avoiding that it appers in another words could not connect to the server.
2nd = second there is a wrong argument.
3rd = A political security from your forum phpBB

Comment/Reply (w/o sign-up)

vhortex
QUOTE (emersonbrum @ Apr 25 2005, 04:24 PM)
It looks a problem in your code. You sould take a look there to fix it up.

The fist line is telling you that there is problem in your code avoiding that it appers in another words could not connect to the server.
2nd = second there is a wrong argument.
3rd = A political security from your forum phpBB
*


CODE
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 48

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331
phpBB : Critical Error

Could not connect to the database
*


im sorry but I do believe that you have a misconception about the problem. The real error is the socket can no longer accept the connection.

the next errors are the results of the 1st error.

since the socket cannot process the request made and the webserver cannot create a connection, then mysql4.php also cannot finish its connection routine thus it output the errors that it have invalid arguments.

in short, mysql4.php expects that it eithers get granted to access or be denied to the database.. since it cannot verify either of the two, it just output a generic error that there are some invalid arguments.. actually the one that output that are the webservers.

Comment/Reply (w/o sign-up)

(G)tohir
what is it?
MySQL Database Problems

Warning: mysql_connect() [function.Mysql-connect]: Access denied for user (using password: YES) in z:\home\localhost\www\forum\db\mysql4.Php on line 48 Access denied for user '' (using password: YES) 
Please help!
 
-question by tohir

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : mysql, database, problems

  1. Login System
    I want to make a login system using Mysql. I am amateur in these thing (10)
  2. Free Or Opensource Database/schema Browser?
    Alternatives to TOAD or PL/SQL Developer (6)
    I was wondering if there were any alternatives to TOAD or PL/SQL Developer that allows you to browse
    through a database(s), the different schema objects, and perhaps the stored
    procedure/function/packakge editors. One thing I have tried is to the use the Data Tool Plugins set
    for my Eclipse but that brings my machine's performance to crawl. One a further note, I am
    basically looking for Windows environment, with connections to remoate databases.....
  3. Mysql Overhead
    (3)
    Sometimes in a table especially if i do alot of things in it i start seeing overhead then a size
    near it? what is overhead? and is it essential to optimize the table to fix it? I know its just a
    press of a button but i'd like to know what happens when i optimize a table. Also when you make
    a new table you can limit the size of VARCHAR to a number, that number would be the number
    characters allowed in that column per entry. I'd like to know how the limit works for texts, is
    it in KB? or number of characters? Cuz i made a messaging system. And i remember reading s....
  4. How To Understand A Database Schema
    A very nice and simple tutorial (7)
    Yesterday while i'm seaching for a data model and database schema at the Library of Free Data
    Models for a new project of a friend of mine i found there this nice and simple tutorial on How to
    Understand a Database Schema . As its name says, this tutorial will help you to better understand a
    Database Schema and covers the following basics topics that every Database Schema must define:
    QUOTE Primary and Foreign Keys. One-to-Many and Many-to-Many Relationships. Inheritance.
    "Rabbit's Ears", (Recursive relationships). The Scope of this tutorial is ....
  5. Best Database
    (16)
    What is the best free database if some one trying built a social networking website? And how to
    operate it with dreamweaver 8?....
  6. Some Useful Database Links.
    (7)
    I thought I would take a moment to point the users here to some of the database resources available
    for reference and learning. First I will start with actually designing the database. This site by
    R937 covers the basics of database design. The author is professional database guru and a frequent
    helper at the at DB forums listed below. The Library of Free Data Models is an excellent
    resource for finding data models for projects you may have or as examples of well put together data
    models. With around 500 data models the chances are you find something at least cl....
  7. Mysql Multiple Tables
    (2)
    It is good practice to use multiple tables to sort out big amounts of data. But once you do that it
    becomes increasingly hard to cross reference the tables. Mysql has a little beautiful command
    structure that they have added. You can select multiple tables within one sql query. Example of a
    basic sql query CODE $sql = "SELECT * FROM table WHERE row=1"; If you noticed that I selected
    all of the rows in the table. Normally you will try to not select the entire table from the database
    unless you absolutely want all of the table. I would recommend against it; just gra....
  8. Any Website Provide Free Host Mysql Host?
    (4)
    any website provide free host mysql host? i need it because i am using 000webhost.com now but it
    only provide 2 mysql database... can i know where or how can i get more databases regards....
  9. Database Access On Remote Server W/jsp
    (1)
    Hello: I am new to JAVA and server-side applications and have a dumb question. I have set up
    Tomcat on my machine and created a JSP program to query an Access database using a DSN-Less
    connection. If I publish the page to a webserver and include the .MDB file will it work? I'm
    not sure exactly what needs to be packaged with my Java application to make it work. Since I
    don't have a remote server that supports .jsp I cannot really test it. I'm assuming that
    JDBC driver would be bundled with my site but not sure. Thanks!....
  10. Space Needed For Database
    (10)
    Iam assuming the information in the databases i will create will be stored in the 500 MB space i
    get, but since 500MB isn't enough iam wondering if you guys can tell me how much bytes the
    following take: Varchar(x),Tinyint,Text,date,smallint,mediumint,bigint,float.... And the rest
    present when you add/edit a row in a table. Also what are the ranges of tinyint,smallint,mediumint
    and big int....
  11. Mysql On Computer
    XD (9)
    I posted PHP on computer? , but for some reason it doesn't show :/. Anyways I am wondering if
    there is MYSQL on my computer, meaning can i make a data base on my computer? that way i make what i
    want and upload it when i get hosted =)....
  12. Mysql Database Entry By Excel Sheets
    (2)
    Hello .. I would like to ask if i can use use Microsoft excel files in order to make entries to
    mysql database. Thanks....
  13. Mysql Database Management
    (1)
    Hi i am new, I have a problem in understanding the query decomposition in D-DB. Can anyone help me
    to understand the first question of the exercise 25.21 of Elmasri-Navath 4th edition? Consider the
    following relations: BOOKS (Book#, Primary_author, Topic, Total_stock, $price) BOOKSTORE (Store#,
    City, State, Zip, Inventory_value) STOCK (Store#, Book#, Qty) Consider a distributed database for a
    bookstore chain called National Books with 3 sites called EAST, MIDDLE, and WEST. Consider that
    BOOKS are fragmented by $price amounts into: B1:BOOK1:up to $20. B2:BOOK2:from ....
  14. Mysql And User File_priv
    (0)
    HI, I've hit the grain while trying to import file to mysql database - I need to enable file
    permissions of the database user but this seems not possible with most of the hosting providers.
    The problem is to set file_priv of the database user to "Y" . This is done in the "user" table of
    the maintanance database named "mysql". cPanel doesn't allow this. Via the cPanel you can only
    allow privileges on table querries but you cannot grant host file privileges to the database user -
    which makes querries like: "LOAD DATA INFILE 'filename' INTO TABLE tablen....
  15. Accessing Ms Access Database From A Centralized Location?
    (8)
    Hi I am a manager at a trading/wholesaling company (and have no programming background). I
    customized the Northwind sample access database to make invoices and keep accounts for my company.
    We now opening another office at a distant location. So, the order entry will be done at two
    points(we plan to use the same Access database). I am not able to figure out how to access the same
    MS Access database from two different location(as LAN can't be used). Moreover, we can't
    afford to pay huge sums to the software developers. Can intranet or uploading the database t....
  16. I Have An Error With My Mysql Connection
    mysql connection error (7)
    ok so here's my web page... http://lacrossems.t35.org/ it only lags cause its trying to
    connect to the my sql server...i followed this guide
    http://forum.ragezone.com/showthread.php?t=387249 and when i edit my config.php to my host and
    login info i always get the error cannot connect to the database here is my config.php if you can
    help me CODE $host = 'CENSORED';                // my host $host =
    'righto';       // my database username $host = 'CENSORED';   // my database
    password $host = 'odinms';       // my datab....
  17. Mysql - So Hard
    Come in here if you think MySQL is soo hard! (14)
    Doesn't anybody think MySQL is so hard to code? I mean think about it, you need loads of
    databases just for one little script and you have to type things in like ;Host-Username:
    (blahblah) ;Host-Password: (blahblah) ;Host-DatabaseName: (blahblah) Ok, that MySQL code was
    random, and it is alot harder than that. If you have expierenced it being hard, you are free to
    post right in here, mate.....
  18. Login System Using A Mysql Db
    How do i do this? (5)
    Hi guys, ive got a registration system that looks something like the one below: Firstname:
    Lastname: Then i have inset.php, which looks like the following: $con =
    mysql_connect("localhost","autobot","abc123"); if (!$con) { die('Could not connect: ' .
    mysql_error()); }mysql_select_db("my_db", $con);$sql="INSERT INTO person (username, password) VALUES
    ('$_POST ','$_POST ')";if (!mysql_query($sql,$con)) { die('Error: ' .
    mysql_error()); } echo "1 record added";mysql_close($con) ?> Now my question is, how do i creat....
  19. Mysql And Php
    When trying to install Joomla (16)
    I don't know if this is the correct forum, but here is my question: I'm trying to test
    Joomla and some forums in my computer, I have already installed MySQL with the GUI tools, Apache,
    and PHP with the MySQL and MySQLi extensions, but when I'm trying to install Joomla I get this
    error: Required Settings Check: ------------------------------------- PHP version >= 4.1.0
    Yes - zlib compression support Available - XML support Available - MySQL support
    Unavailable configuration.php Writeable Session save path Unwriteable Not ....
  20. Navcat For MySQL
    is Navcat any good? (9)
    Hello all, i ve recently come across NavCat (GUI tool) for MySQL. I have not bought a copy yet, just
    played around with the demo. Has any one used it beore, if so please let me know if its worth
    buying. I already have PhpMyadmin, Just wanna know if NavCat is better than PhpMyAdmin in usibility
    and functionality. Regards....
  21. Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database
    (6)
    Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a
    good practice to directly store images and other binary files in a MySQL database. Any one with
    help? Thanks....
  22. MySQL, Multiple Tables
    (25)
    Ok, I'm coding a project which is a leap than what I'd normally do. Before, I've always
    learned ONE table... put EVERYTHING in one database table. I'm making a profile system so there
    needs to be at least two tables: 1 for users, 1 for content. My problem is, how do I link the two
    together? I could probably figure this out faster if someone explained and posted sample SQL code
    that shows how the two are linked together. Thanks!! F....
  23. MySQL Output Database Question
    (18)
    I am new to MySql and have just created a database after using a script. My problem is not the
    script, but what it says about putting it into the output file. I cant figure out the right terms
    to put it in, I keep getting errors. I try using; SELECT*FROM 'database name' WHERE
    'location' but it isnt working. I'm lost with this stuff, I really am. Can someone
    please help me out?....
  24. What Are The Alternatives To MySQL
    (7)
    Hi. i'm interested in alternatives to MySql combined with php. what database else can i use to
    create a webbased managment system with a lot of entries. maybe more than mysql can handle fast
    enough. it should be more powerful than mysql and should have nearly the same features. i hope
    there is a webbased administration program like phpmysqladmin thanks for your help ! greetings c.....
  25. Mirror My MySQL Database To Another Mysql Server
    (7)
    Hi..I want to ask if its possible to automatically mirror my mysql databases into another mysql
    server?or create a small php script to do this? The reason is because, we all know that database is
    very improtant if we have dynamic website. I have my forum hosted and i want to automatically
    mirror this or backup into another mysql server(free). Like in freesql.org. So that im not afraid
    that i forgot to backup my database..also i have one central backup database. Thanks for the
    help..Im looking forward for this posibility.....
  26. Recover Tables From A MySQL .frm File
    (9)
    I have a couple of .frm files with no corresponding data or index files. Is it possible to recover
    the table structure (field names, types, sizes, rows,col, etc) from these files? The table type is
    innodb....
  27. Error In Installing MySQL Server
    MySQL server cannot be started (7)
    I try to upgrade my MySQL server from 4.018 to 4.1.10a. Firstly, I downloaded mysql-4.1.10a (not the
    essential one) for win XP Then I install the new version after the old version was uninstalled.
    After the installation process, Instance Configurator comes up to help for the configuration. But an
    error occured when it try to start the MySQL service. Error messageis "cannot create windows
    service for MySQL. Error:0" So my MySQL server cannot be started. It is running win XP on my
    computer. Does anybody can tell me what is wrong?. Thanks (sorry for my bad english)....
  28. How Can I Import Csv Files To My MySQL Database?
    I was able to export but where's import? (3)
    I am having hard times finding that import csv in the mysql phpmyadmin. I once worked on some csv
    files and someone imported it on the mysql server. I was not able to ask him. Does someone know how
    can I import csv files in mysql server?....
  29. MySQL Realtime Replication
    how to replicate mysql in realtime (4)
    i dont know if this might be useful to ppl here, but this is a very good knowledge for serious
    siteadmins. while i was digging for mysql backup techniques, i've found that mysql is able to
    do realtime replication. the idea is that there are master server and slave server. both are having
    the same version of mysql installed. the data flows; Master >copy> Slave ( in realtime!)
    you'll never have to manually copy the database file of wasting your time to manually use the
    mysqldump command. here are the links; http://dev.mysql.com/doc/mysql/en/Replication_HOWTO.h....
  30. MySQL - Trouble With Bulk Insert Statements
    (3)
    I'm trying to insert about 500 rows into mysql, but I keep getting errors. If I copy and paste
    too many (about 50) insert statements at a time I get errors sometimes. I sometimes even get errors
    but then the row is skipped so I don't know there was an error (I'm using linux and SSH).
    What's the best way to get my insert statements to put the data in MySQL? Is there anyway that I
    can have it tell me if there where any errors all the statements are executed? Thanks for your
    help.....

    1. Looking for mysql, database, problems

See Also,

*SIMILAR VIDEOS*
Searching Video's for mysql, database, problems
advertisement



MySQL Database Problems

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com