0

hi,
my client side files are in one server and server side codes and the mysql in one
on my client side files config i see the below

$config["db_host"] = "mysevercodessideIP";
$config["db_user"] = "myuser";
$config["db_pass"] = "mypassword";
$config["db_name"] = "myDBName";

i get the error MySQL Error:Can't connect to local MySQL server through socket '/var/run/mysqld/mysql but i looked st the server side codes and they connect below way jdbc:mysql://localhost/myDBName?user=myuser&password=mypassword what do you think is wrong?

thank you

Edited by nakresimin: n/a

2
Contributors
31
Replies
34
Views
5 Years
Discussion Span
Last Post by nakresimin
0

Check with following from client machine:

mysql -u username -h mysqlserverIP -pPassword

is this able to connect to mysqlserverIP??

If not try following from client:

nmap -P0 mysqlserverIP

check/post outpute if its showing port 3306 open and accessible


SPAM DELETED

Edited by happygeek: n/a

0

i dont know what you mean with client machine, if i understand it correct it is in shared web hosting, i cannot do much
but if i do the codes on the server i have
i get this

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

and this

nmap -P0 mysqlserverIP
-bash: nmap: command not found

Edited by nakresimin: n/a

0

my client side files are in one server and server side codes and the mysql in one
on my client side files config i see the below

(Toggle Plain Text)
$config["db_host"] = "mysevercodessideIP";
$config["db_user"] = "myuser";
$config["db_pass"] = "mypassword";
$config["db_name"] = "myDBName";

i get the error
MySQL Error:Can't connect to local MySQL server through socket '/var/run/mysqld/mysql

above is your post....so what is client here buddy???

0

i am sorry, i am not a coder and i am trying to learn

what i was trying to say is
server side codes, mysql and application is on my dedicated server. i have shell access to it

but the websites files trying to connect to my database are in one shared hosting. i dont have shell access

can you still help please?

websites settings are below which cannot connect
$config["db_host"] = "mysevercodessideIP";
$config["db_user"] = "myuser";
$config["db_pass"] = "mypassword";
$config["db_name"] = "myDBName";

part of the server side application settings is below which connect with no problems

jdbc:mysql://localhost/myDBName?user=myuser&password=mypassword

Edited by nakresimin: n/a

0

that means all application or website data and mysql database is on single server??

Here database IP or name is localhost??

As per your previous comments you are able to access database using "localhost" name like "mysql -h localhost -u username -pPassword"

correct if am wrong somewhere....

And you are trying to access database from your php application?

if all above are correct then post the output of "use mysql;" , "select user,host from user;" commands

--
Manoj

0

i am sorry if i am being confusing
there are two servers
application and mysql is one one (deticated server) (server side application on this deticated server connects fine to the database)

website files ,i think they are php on one (share web hosting) (this is where i have problems)
does it answer your question

that means all application or website data and mysql database is on single server??

Here database IP or name is localhost??

As per your previous comments you are able to access database using "localhost" name like "mysql -h localhost -u username -pPassword"

correct if am wrong somewhere....

And you are trying to access database from your php application?

if all above are correct then post the output of "use mysql;" , "select user,host from user;" commands

--
Manoj

0

no probs buddy...thanks for your clarification this sounds good now....

1) can you check IP address of your php app server....

2) try "telnet mysqlserverIP 3306" from php app server.....if this is able to connect then try step 3) else go to step 4)

3) Login to mysql server and post the output of "use mysql;" , "select user,host from user;" commands

if user as "myuser" and hostname as "phpappserverIP" is defined in output you can connect to mysql server from php app server else run following commands to grant permissions to php app server IP

grant all privileges on dbname.* to myuser@'phpserverIP' identified by 'password';
flush privileges;

4) Login to mysql server and open/enable (firewall) mysql port 3306 allowed from php app server IP

5) Now try to access from php app server

SPAM DELETED

Edited by happygeek: n/a

0

1.how do i do that?
2.where do i type that command?

no probs buddy...thanks for your clarification this sounds good now....

1) can you check IP address of your php app server....

2) try "telnet mysqlserverIP 3306" from php app server.....if this is able to connect then try step 3) else go to step 4)

3) Login to mysql server and post the output of "use mysql;" , "select user,host from user;" commands

if user as "myuser" and hostname as "phpappserverIP" is defined in output you can connect to mysql server from php app server else run following commands to grant permissions to php app server IP

grant all privileges on dbname.* to myuser@'phpserverIP' identified by 'password';
flush privileges;

4) Login to mysql server and open/enable (firewall) mysql port 3306 allowed from php app server IP

5) Now try to access from php app server

--
Manoj
http://linuxtroubleshoot.blogspot.com/
http://dbmysql.blogspot.com/

0

are you able to connect to mysql server using terminal or ssh???

when login to server using ssh then goto mysql prompt by "mysql" command then use those commands....related mysql

0

3)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'telnet mysqlserverIP 3306
use mysql' at line 1

code)

+--------------+--------------------+
| user         | host               |
+--------------+--------------------+
| cratospo_ker | %                  |
| root         | %                  |
| root         | 127.0.0.1          |
|              | 44911.server.local |
| root         | 44911.server.local |
|              | localhost          |
| cratospo_ker | localhost          |
| root         | localhost          |
+--------------+--------------------+
8 rows in set (0.00 sec)

no probs buddy...thanks for your clarification this sounds good now....

1) can you check IP address of your php app server....

2) try "telnet mysqlserverIP 3306" from php app server.....if this is able to connect then try step 3) else go to step 4)

3) Login to mysql server and post the output of "use mysql;" , "select user,host from user;" commands

if user as "myuser" and hostname as "phpappserverIP" is defined in output you can connect to mysql server from php app server else run following commands to grant permissions to php app server IP

   grant all privileges on dbname.* to myuser@'phpserverIP' identified by 'password';
   flush privileges;

4) Login to mysql server and open/enable (firewall) mysql port 3306 allowed from php app server IP

5) Now try to access from php app server

--
Manoj

Edited by mike_2000_17: Fixed formatting

0

try "telnet mysqlserverIP 3306" from php app server

and what is your php app server name or IP, is php app server IP available in output of "select user,host from user" command at mysql server?

that means in your last post, output of "select user,host from user" showing php server name or IP?

0

nothing came up, how can i find that?

try "telnet mysqlserverIP 3306" from php app server

and what is your php app server name or IP, is php app server IP available in output of "select user,host from user" command at mysql server?

that means in your last post, output of "select user,host from user" showing php server name or IP?

0

can you please let me know the name or IP address of your php app server and output of commands like below:

[root@mypc ~]# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16439
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+-------+-----------+
| user | host |
+-------+-----------+
| root | 127.0.0.1 |
| | localhost |
| cacti | localhost |
| root | localhost |
| | njd-aldo |
| root | njd-aldo |
+-------+-----------+
6 rows in set (0.00 sec)

--
Manoj

0

when i entered the password of the database i want to use, it game error but when i used the root password i got the below result

[root@44911 /]# mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@44911 /]# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+--------------+--------------------+
| user         | host               |
+--------------+--------------------+
| cratospo_ker | %                  |
| root         | %                  |
| root         | 127.0.0.1          |
|              | 44911.server.local |
| root         | 44911.server.local |
|              | localhost          |
| cratospo_ker | localhost          |
| root         | localhost          |
+--------------+--------------------+
8 rows in set (0.00 sec)

mysql>
0

yes this is what I need....you must login from php server to mysql server using user root and password specified you....plz run following on mysql server on mysql prompt:

flush privileges;

try to login from php app server using following:

yum -y install nmap

nmap -P0 mysqlserverIP

if port 3306 is opened and accessible (you can find by above command) try following:

mysql -u root -h mysqlserverIP -pPassword


if you are getting any error post it here

0

so i used ssh
first i did this "yum -y install nmap" it installed
then below

[root@44911 /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> nmap -P0 mysqlserverIP
    -> mysql -u root -h mysqlserverIP -pPassword
    ->

yes this is what I need....you must login from php server to mysql server using user root and password specified you....plz run following on mysql server on mysql prompt:

flush privileges;

try to login from php app server using following:

yum -y install nmap

nmap -P0 mysqlserverIP

if port 3306 is opened and accessible (you can find by above command) try following:

mysql -u root -h mysqlserverIP -pPassword


if you are getting any error post it here

Edited by nakresimin: n/a

0

buddy plz read comments carefully I told you to run following from php app server:

[From terminal not from mysql prompt:

yum -y install nmap

nmap -P0 mysqlserverIP

if port 3306 is opened and accessible (you can find by above command) try following:

mysql -u root -h mysqlserverIP -pPassword

if you are getting any error post it here]

0

thank you for still not giving up on me

i am sorry i dont know what is php server, i wen to ssh for my deticated server and from terminal i run below

this is installed "yum -y install nmap"

[root@44911 /]# nmap -P0 mysqlserverIP

Starting Nmap 5.21 ( [url]http://nmap.org[/url] ) at 2011-12-27 00:24 MST
Failed to resolve given hostname/IP: mysqlserverIP.  Note that you can't use '/mask' AND '1-4,7,100-' style IP ranges
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 0.22 seconds
[root@44911 /]#

buddy plz read comments carefully I told you to run following from php app server:

[From terminal not from mysql prompt:

yum -y install nmap

nmap -P0 mysqlserverIP

if port 3306 is opened and accessible (you can find by above command) try following:

mysql -u root -h mysqlserverIP -pPassword

if you are getting any error post it here]

Edited by nakresimin: n/a

0

buddy just look into above ur comments u told me there is 1 one db and another one is where ur php or web files are located.....according to that am assuming these things

so plz confirm how many servers are there and is db and application server on different machines or on single machine??

0

there are two servers
1. application(electroserver, a gaming server) and mysql, both of them are in my deticated server

2. website files ,they are written in php are on one (share web hosting i dont have access to i can only put my files using ftp.)

0

so you are trying to access mysql db from php, am i right?

both the servers are on single hosting company?

and what is output of "nmap -P0 your-mysql-server-name-or-IP" ?

0

they are on two different hosting company
i used the ip , xxx.xx.x.xxx , for my deticated server , i dont know "mysql-server-name"

[root@44911 /]# nmap -P0 xxx.xx.x.xxx

Starting Nmap 5.21 ( [url]http://nmap.org[/url] ) at 2011-12-27 00:49 MST
Illegal character(s) in hostname -- replacing with '*'
Illegal character(s) in hostname -- replacing with '*'
Nmap scan report for ** (xxx.xx.x.xxx)
Host is up (0.000062s latency).
Not shown: 993 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
1935/tcp open  rtmp
3306/tcp open  mysql
5080/tcp open  unknown
8088/tcp open  unknown
8443/tcp open  https-alt
9999/tcp open  abyss

Nmap done: 1 IP address (1 host up) scanned in 0.44 seconds
[root@44911 /]#

so you are trying to access mysql db from php, am i right?

both the servers are on single hosting company?

and what is output of "nmap -P0 your-mysql-server-name-or-IP" ?

0

you executed "nmap" from php app server to mysql server??


buddy if mysql server and php app server both servers are on different hosting company servers I think mysql port should not be opened for different hosting company servers....

0

i have the deticated server where i have all the access, i have my databse set there and let say you have your website an you are trying to connect to my db, let's say i gave you all the credentials but when you try to access my database you are having that error

is it a little more clear?

thank you

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.