You are invited to Log in or Register a free Frihost Account!

Getting host to connect to my local mysql?

Okay, if you read my post before, I was wondering how to get my host (apache) to connect to Frihost's mysql.

Now it's the other way around. I want my host to connect to MY mysql server which is hosted on my computer.

$conn = mysql_connect("MYIPADDRESSHERE","root","");
mysql_select_db(debbosql) or die("<font size='2'>There is a problem with the MYSQL Server</font>");

Of course, I replaced "MYIPADDRESSHERE" with my actual IP. For the "" that are blank, that is my password because I am unable to set one. :S:S. This doesn't work and I get "There is a problem with the mysql server."

So, how do I allow my webhosting to connect to my server? The .exe of my mysql server is allowed Inbound, and it is set to prompt me outbound. I have Windows Firewall disabled.

Any way to fix this?
Is the port that MySQL uses (3306, I believe) forwarded to your computer? It needs to be, otherwise your modem/router will block the connection from Frihost.
If I have a modem do I still have to allow the port? If so, then how do I do that?
No - your modem shouldn't have any firewall or NAT software. Unfortunately that means your problem is elsewhere...

Check that MySQL is set to allow non-local connections. By default it is, but if you've used an installer for beginners it may turn it off for security.

Also, for MySQL logins you need to specify the host as well. So, your login details for username@localhost won't work unless you tell MySQL to allow username@<insert frihost IP here>.

Try having a look at MySQL Administrator if you need a GUI for this:
I am using WinMySQLAdmin because it comes with Xampp, I can't seem to find the non-local connections in my.ini.

Any ideas? Should I upgrade to the MySQL Administrator?
The command you're looking for in my.ini is

which tells MySQL not to load the TCP/IP module.

MySQL Administrator is only useful for administering the users (not the general configuration of the server through my.ini) and I'd assume that WinMySQLAdmin does similar so it's not worth changing.

I've never used WinMySQLAdmin though. Note that there's nothing stopping you having them both installed at the same time!

Good luck. Very Happy
Okay, I removed the comment from the line "skip-networking'.

# Example MySQL config file for small systems.
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
# You can copy this file to
# C:/xampp/mysql/bin/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is C:/xampp/mysql/data) or
# ~/.my.cnf to set user-specific options.
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
password       = MYPASSWORD :O
port            = 3306
socket          = mysql

# Here follows entries for some specific programs

# The MySQL server

port            = 3306
socket          = mysql

character-set-server = latin1
collation-server = latin1_general_ci

key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
server-id   = 1

# Uncomment the following if you want to log updates

# Uncomment the following if you are NOT using BDB tables

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = C:/xampp/mysql/data/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = C:/xampp/mysql/data/
#innodb_log_arch_dir = C:/xampp/mysql/data/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#set-variable = innodb_buffer_pool_size=16M
#set-variable = innodb_additional_mem_pool_size=2M
# Set .._log_file_size to 25 % of buffer pool size
#set-variable = innodb_log_file_size=5M
#set-variable = innodb_log_buffer_size=8M
#set-variable = innodb_lock_wait_timeout=50


# Remove the next comment character if you are not familiar with SQL

key_buffer = 8M
sort_buffer_size = 8M

key_buffer = 8M
sort_buffer_size = 8M



Now my MYSQL server just starts and then 5 seconds later turns off. Whats up!?!?
Uh... you WANT skip-networking to be commented out because you DON'T want to skip networking.
Put it back! Put it back! Wink

When you try to connect to your machine what exactly is the error you are getting?
Can it just not connect, unable to find the host or are you getting and access denied error?
Diablosblizz wrote:
Any ideas? Should I upgrade to the MySQL Administrator?

.... No , go get Navicat or Sqlyog, theyre really good, or theres one i used on linux which should be avaliable for windows as well, uhh what was it called.... Mysql-Navigator or something like that.

Out of all those, i'd go with navicat, its user friendly, easy to use, and well, idk, i use this one the most for quick queries and stuff.. If i have some sort of really large database, i go with sqlyog cuz it executes quicker (ALOT QUICKER).

Navicat, requires money but its well worth it. And Sqlyog, has a free version but theres another one as well. I wouldnt pay for sqlyog cuz i dont use it that much.

@Hogwarts - Yes , navicat runs on port 3306 by default.

Also , i've always installed mysql separately from xampp, idk why i just did lol.
Access denied for user 'hmms'@'localhost' (using password: NO)

I get that, but thats odd because if you look at the code its this:

$conn = mysql_connect("myip","root","");
mysql_select_db(debbosql) or die(mysql_error());

User: root
Password: no

Now go back to the error, the user is HMMS@localhost, but why? My account username is hmms (for Cpanel), should I add http infront of my IP or something? Cause it is thinking it is connecting to the LOCALHOST server, when really it isn't.

Any ideas?
What's more peculiar is that the username shouldn't have single quote marks around and in it!
it should say:

Access denied for user root@yourIP (using password: YES)

This leads me to believe that this piece of code you are looking at isn't the cause of the problem. Does the page have any includes() which also use mysql_connect() ?
Unfortuantly, my hosting suspended my account for only god knows why. I'm going to figure out why they did it this afternoon as I am at school.

For the code, no, there is no includes, just pretty much like this (not exact cause I can't get files)

$conn = mysql_connect("MYIPADDRESSHERE","root","");
mysql_select_db(debbosql) or die("<font size='2'>There is a problem with the MYSQL Server</font>");

$hotelclient = $_GET['hotelclient'];

echo $hotelclient


No includes, but there is a config.php file that is in a different directory that uses hmms (but it is not included).
For a beginner as me, I am using wamp server to do PHP and MySQL connection. It is automatically setup the database by using the phpMyAdmin page. You can have try on it. It should be able to connect the database much more easier.
Related topics
Build an online dictionary by PHP/MySQL
MySQL DB Backup script - minor problem
MySQL Masters Binary Logs & Replication?
php can't connect to mysql
error: Can't connect to local mysql server through socket
Connect to MySql database
A very good PHP MySQL Tutorial
Warning: mysql_connect(): Client does not support authentica
MySQL connection error on Server 2?
Connect mySQL to Zend or Other
Server Two MySQL Down
#2002 - The server is not responding (or the local MySQL ser
Database connection error (2): Could not connect to MySQL.
Could not connect to MySQL.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.