Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 22-04-2009
Member
 
Join Date: Nov 2008
Posts: 866
How to connect to mysql from outside

I was looking how to access a mysql database from outside. I try to connect two PC together by a crossover cable, the ping works fine.

PC 1: 192.168.0.1
PC 2: 192.168.0.2 contains database

except that when I try to access the mysql database from the other pc
by typing:

mysql-h 192.168.0.2-u root-p123456 it gives me an error message:
can not connect to mysql server on 192.168.0.2.

At the mysql configuration allows the root I can connect from other machine + add the port number (3306) a list of exceptions, but the same error.

Please help me.
Reply With Quote
  #2  
Old 22-04-2009
Member
 
Join Date: May 2008
Posts: 685
Re: How to connect to mysql from outside

Have you commented on the variable bind-address in my.cnf (or the variable skip-networking)? This variable is used to indicate which hosts are allowed to connect to MySQL server.
Reply With Quote
  #3  
Old 22-04-2009
XSI XSI is offline
Member
 
Join Date: May 2008
Posts: 271
Re: How to connect to mysql from outside

It is actually in the my.ini, 35 to the line with me:

Code:
# The MySQL server 
[mysqld] 
datadir = C: / Program Files / EasyPHP 2.0b1/mysql/data 
basedir = C: / Program Files / EasyPHP 2.0b1/mysql 
# bind-address = 127.0.0.1 <<================ HERE 
# Uncomment for use on USB key 
# skip-innodb 
port = 3306 
socket = /tmp/mysql.sock
Reply With Quote
  #4  
Old 22-04-2009
Member
 
Join Date: Nov 2008
Posts: 866
Re: How to connect to mysql from outside

I find it good that my line:

Code:
# MySQL Server Instance Configuration File 
  # ------------------------------------------------- --------------------- 
  # Generated by the MySQL Server Instance Configuration Wizard 
  # 
  # 
  # Installation Instructions 
  # ------------------------------------------------- --------------------- 
  # 
  # On Linux you can copy this file to / etc / my.cnf to set global options, 
  # Mysql-data-dir/my.cnf to set server-specific options 
  # (@ Localstatedir @ for this installation) or to 
  # ~ /. My.cnf to set user-specific options. 
  # 
  # On Windows you should keep this file in the installation directory 
  # Of your server (eg C: \ Program Files \ MySQL \ MySQL Server XY).  To 
  # Make sure the server reads the config file use the startup option 
  # "- Defaults-file". 
  # 
  # To run run the server from the command line, execute this in a 
  # Command line shell, eg 
  # Mysqld - defaults-file = "C: \ Program Files \ MySQL \ MySQL Server XY \ my.ini" 
  # 
  # To install the server as a Windows service manually, execute this in a 
  # Command line shell, eg 
  # Mysqld - install MySQLXY - defaults-file = "C: \ Program Files \ MySQL \ MySQL Server XY \ my.ini" 
  # 
  # And then execute this in a command line shell to start the server, eg 
  # Net start MySQLXY 
  # 
  # 
  # Guildline for editing this file 
  # ------------------------------------------------- --------------------- 
  # 
  # In this file, you can use all long options that the program supports. 
  # If you want to know the options a program supports, start the program 
  # With the "- help" option. 
  # 
  # More detailed information about the individual options can also be 
  # Found in the manual. 
  # 
  # 
  # CLIENT SECTION 
  # ------------------------------------------------- --------------------- 
  # 
  # The following options will be read by MySQL client applications. 
  # Note that only client applications shipped by MySQL are guaranteed 
  # To read this section.  If you want your own MySQL client program to 
  # Honor these values, you need to specify it as an option during the 
  # MySQL client library initialization. 
  # 
  [Customer] 

  Port = 3306 

  [Mysql] 

  Default-character-set = latin1 


  # SERVER SECTION 
  # ------------------------------------------------- --------------------- 
  # 
  # The following options will be read by the MySQL Server.  Make sure that 
  # You have installed the server correctly (see above) so it reads this 
  # File. 
  # 
  [Mysqld] 

  # The TCP / IP Port the MySQL Server will listen on 
  port = 3306 

  # Path to installation directory.  All paths are usually resolved relative to this. 
  basedir = "C: / Program Files / MySQL / MySQL Server 5.0 /" 

  # Path to the database root 
  datadir = "C: / Program Files / MySQL / MySQL Server 5.0/Data /" 

  # The default character set that will be used when a new schema or table is 
  # Created and no character set is defined 
  default-character-set = latin1 

  # The default storage engine that will be used when create new tables when 
  default-storage-engine = INNODB 

  # Set the SQL mode to strict 
  sql-mode = "STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION" 

  # The maximum amount of concurrent sessions the MySQL server will 
  # Allow.  One of these connections will be reserved for a user with 
  # SUPER privileges to allow the administrator to login even if the 
  # Connection limit has been reached. 
  max_connections = 100 

  # Query cache is used to cache SELECT results and later return them 
  # Without actual executing the same query once again.  Having the query 
  # Cache enabled may result in significant speed improvements, if your 
  # Have a lot of identical queries and rarely changing tables.  See the 
  # "Qcache_lowmem_prunes" status variable to check if the current value 
  # Is high enough for your load. 
  # Note: In case your tables change very often or if your queries are 
  # Textually different every time, the query cache may result in a 
  # Slowdown instead of a performance improvement. 
  query_cache_size = 15M 

  # The number of open tables for all threads.  Increasing this value 
  # Increases the number of file descriptors that mysqld requires. 
  # Therefore you have to make sure to set the amount of open files 
  # Allowed to at least 4096 in the variable "open-files-limit" in 
  # Section [mysqld_safe] 
  table_cache 256 

  # Maximum size for internal (in-memory) temporary tables.  If a table 
  # Grows larger than this value, it is automatically converted to disk 
  # Based table This limitation is for a single table.  There can be many 
  # Of them. 
  tmp_table_size = 18M 


  # How many threads we should keep in a cache for reuse.  When a client 
  # Disconnects, the client's threads are put in the cache if there are not 
  # More than thread_cache_size threads from before.  This greatly reduces 
  # The amount of thread creations needed if you have a lot of new 
  # Connections.  (Normally this does not give a notable performance 
  # Improvement if you have a good thread implementation.) 
  thread_cache_size = 8 

  # *** MyISAM Specific options 

  # The maximum size of the temporary file MySQL is allowed to use while 
  # Recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. 
  # If the file-size would be bigger than this, the index will be created 
  # Through the key cache (which is slower). 
  myisam_max_sort_file_size = 100G 

  # If the temporary file used for fast index creation would be bigger 
  # Than using the key cache by the amount specified here, then prefer the 
  # Key cache method.  This is mainly used to force long character keys in 
  # Large tables to use the slower key cache method to create the index. 
  myisam_sort_buffer_size = 35M 

  # Size of the Key Buffer, used to cache index blocks for MyISAM tables. 
  # Do not set it larger than 30% of your available memory, as some memory 
  # Is also required by the OS to cache rows.  Even if you're not using 
  # MyISAM tables, you should still set it to 8-64M as it will also be 
  # Used for internal temporary disk tables. 
  key_buffer_size = 23M 

  # Size of the buffer used for doing full table scans of MyISAM tables. 
  # Allocated per thread, if a full scan is needed. 
  read_buffer_size = 64K 
  read_rnd_buffer_size = 256K 

  # This buffer is allocated when MySQL needs to rebuild the index in 
  # REPAIR, Optimzer, ALTER table statements as well as in LOAD DATA INFILE 
  # Into an empty table.  It is allocated per thread so be careful with 
  # Large settings. 
  sort_buffer_size = 256K 


  # *** INNODB Specific options *** 


  # Use this option if you have a MySQL server with InnoDB support enabled 
  # But you do not plan to use it.  This will save memory and disk space 
  # And speed up some things. 
  # skip-innodb 

  # Additional memory pool that is used by InnoDB to store metadata 
  # Information.  If InnoDB requires more memory for this purpose it will 
  # Start to allocate it from the OS.  As this is fast enough on most 
  # Recent operating systems, you normally do not need to change this 
  # Value.  SHOW INNODB STATUS will display the current amount used. 
  innodb_additional_mem_pool_size = 2M 

  # If set to 1, InnoDB will flush (fsync) the transaction logs to the 
  # Disk at each commit, which offers full ACID behavior.  If you are 
  # Willing to compromise this safety, and you are running small 
  # Transactions, you may set this to 0 or 2 to reduce disk I / O to the 
  # Logs.  Value 0 means that the log is only written to the log file and 
  # The log file flushed to disk approximately once per second.  Value 2 
  # Means the log is written to the log file at each commit, but the log 
  # File is only flushed to disk approximately once per second. 
  innodb_flush_log_at_trx_commit = 1 

  # The size of the buffer InnoDB uses for buffering log data.  As soon as 
  # It is full, InnoDB will have to flush it to disk.  As it is flushed 
  # Once per second anyway, it does not make sense to have it very large 
  # (Even with long transactions). 
  innodb_log_buffer_size = 1M 

  # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and 
  # Row data.  The bigger you set this the less disk I / O is needed to 
  # Access data in tables.  On a dedicated database server you may set this 
  # Parameter up to 80% of the machine physical memory size.  Do not set it 
  # Too large, though, because competition of the physical memory may 
  # Cause paging in the operating system.  Note that on 32bit systems you 
  # Might be limited to 2-3.5G of user level memory per process, so do not 
  # Set it too high. 
  innodb_buffer_pool_size = 42M 

  # Size of each log file in a log group.  You should set the combined size 
  # Of log files to about 25% -100% of your buffer pool size to avoid 
  # Unneeded buffer pool flush activity on log file overwrite.  However, 
  # Note that a larger logfile size will increase the time needed for the 
  # Recovery process. 
  innodb_log_file_size = 10M 

  # Number of threads allowed inside the InnoDB kernel.  The optimal value 
  # Depends highly on the application, hardware as well as the OS 
  # Scheduler properties.  A too high value may lead to thread thrashing. 
  innodb_thread_concurrency = 8
I didn't used easy php but I install mysql 5.
Reply With Quote
  #5  
Old 22-04-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: How to connect to mysql from outside

You should just add #bind-address = address IP PC1

Following a [mysqld]
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to connect to mysql from outside"
Thread Thread Starter Forum Replies Last Post
How to connect PHP to mySQL Database Nathen Tips & Tweaks 2 17-07-2011 03:49 AM
Connect Adobe Air to MySQL Bailee Windows Software 5 01-07-2010 04:07 PM
Mysql Error : Can't connect to local mysql server through socket ' var lib mysql mysql.sock' 2 roshan45 Software Development 3 07-11-2009 09:36 PM
How to Connect or Disconnect from the MYSQL Server GaryK Software Development 1 10-02-2009 12:29 PM
How to Connect MySQL database from PHP Booth Software Development 3 21-01-2009 09:12 PM


All times are GMT +5.5. The time now is 09:25 PM.