By default the MySQL server will allow connections via TCP/IP from any host (but may reject a connection based on the user's remote hostname/IP address). In many cases TCP/IP connectivity is not required and can be disabled to prevent remote access to the MySQL server. If you are using MySQL locally for development or for use with a web server, you should disable TCP/IP networking.
To disable TCP/IP networking, choose the Detailed Configuration option during installation, and uncheck the Enable TCP/IP Networking option (you can re-configure a server by starting the MySQL Configuration Wizard located at Start > Programs > MySQL > MySQL Server 4.1 > MySQL Server Instance Config Wizard).
Users of older versions of MySQL can add the following lines to the [mysqld] section of your MySQL server configuration file:
skip-networking enable-named-pipes
This will disable TCP/IP connections and enable named pipes. For this to work you must install MySQL on an NT-based Windows operating system, and use the mysqld-nt.exe server binary. The location of your configuration file will vary depending on the version of MySQL you have installed, look for one of the following files:
- C:/my.cnf
- C:/Windows/my.ini
Step 6.1: Using Named Pipes
Once the server is started with named pipe support, you can connect with the following command:
C:/>mysql -h . -u root -p
This will connect to the server using named pipes. With recent (4.1 and higher) servers you can also use the --protocol=pipe option instead of specifying -h . on the command line:
C:/>mysql --protocol=pipe -u root -p
Individual client tools and APIs may use different syntax for connecting via named pipes, consult the documentation of the individual tool or API for information on connecting via named pipes.
connect to mysql via named pipe under windows :
Example 1:
in my.ini, add this:
[mysqld]
enable-named-pipe
then connect to the server, then connect to mysql using
mysql_connect('.')
Example 2:
<?php /// phpBB 3.0.x auto-generated configuration file
$dbms = 'mysqli';
$dbport = '';
$dbhost = '.'; //Turn 'localhost' into '.'
$dbname = 'phpbb';
$dbuser = 'root';
$dbpasswd = 'root';
$table_prefix = 'phpbb_';
$acm_type = 'file';
$load_extensions = '';
@define('PHPBB_INSTALLED', true);// RETURNS, OR ANYTHING ELSE AFTER THE TWO CHARACTERS ON THE NEXT LINE.
?>