www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Mysql-native with LAMPP

reply Geert <gerndz gmail.com> writes:
Hi all!

I tried the client driver for MySQL/MariaDB "mysql-native".

https://github.com/mysql-d/mysql-native

Everything works well with an individually installed version of 
MySql. But I would like to know if there is a way to make D 
programms work with LAMPP/XAMPP. I'm getting this error message 
while executing the program:

host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
Failed: 
std.socket.SocketOSException /build/ldc/src/ldc/runtime/phobos
std/socket.d(2822): Unable to connect socket: Connection refused
Sep 11 2016
parent reply wobbles <grogan.colin gmail.com> writes:
On Monday, 12 September 2016 at 05:31:46 UTC, Geert wrote:
 Hi all!

 I tried the client driver for MySQL/MariaDB "mysql-native".

 https://github.com/mysql-d/mysql-native

 Everything works well with an individually installed version of 
 MySql. But I would like to know if there is a way to make D 
 programms work with LAMPP/XAMPP. I'm getting this error message 
 while executing the program:

 host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
 Failed: 
 std.socket.SocketOSException /build/ldc/src/ldc/runtime/phobos
std/socket.d(2822): Unable to connect socket: Connection refused
You're sure mysql is running?
Sep 12 2016
parent reply Geert <gerndz gmail.com> writes:
On Monday, 12 September 2016 at 09:59:30 UTC, wobbles wrote:
 On Monday, 12 September 2016 at 05:31:46 UTC, Geert wrote:
 Hi all!

 I tried the client driver for MySQL/MariaDB "mysql-native".

 https://github.com/mysql-d/mysql-native

 Everything works well with an individually installed version 
 of MySql. But I would like to know if there is a way to make D 
 programms work with LAMPP/XAMPP. I'm getting this error 
 message while executing the program:

 host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
 Failed: 
 std.socket.SocketOSException /build/ldc/src/ldc/runtime/phobos
std/socket.d(2822): Unable to connect socket: Connection refused
You're sure mysql is running?
Yes, it's running. I started it with LAMPP, and i can access to the database through phpMyAdmin.
Sep 12 2016
parent reply Daniel Kozak via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
And are you sure it is using tcp4 socket on port 3306? You can use 
netstat -tlnp  to see if is running on tcpv4 3306


Dne 12.9.2016 v 15:25 Geert via Digitalmars-d-learn napsal(a):
 On Monday, 12 September 2016 at 09:59:30 UTC, wobbles wrote:
 On Monday, 12 September 2016 at 05:31:46 UTC, Geert wrote:
 Hi all!

 I tried the client driver for MySQL/MariaDB "mysql-native".

 https://github.com/mysql-d/mysql-native

 Everything works well with an individually installed version of 
 MySql. But I would like to know if there is a way to make D 
 programms work with LAMPP/XAMPP. I'm getting this error message 
 while executing the program:

 host=localhost;port=3306;user=root;pwd=MY_testPa550;db=testdb
 Failed: 
 std.socket.SocketOSException /build/ldc/src/ldc/runtime/phobos
std/socket.d(2822): 
 Unable to connect socket: Connection refused
You're sure mysql is running?
Yes, it's running. I started it with LAMPP, and i can access to the database through phpMyAdmin.
Sep 12 2016
parent reply Geert <gerndz gmail.com> writes:
On Monday, 12 September 2016 at 14:00:18 UTC, Daniel Kozak wrote:
 And are you sure it is using tcp4 socket on port 3306? You can 
 use netstat -tlnp  to see if is running on tcpv4 3306
I get nothing with TCP option, only when i run this command: # netstat -npl | grep mysql unix 2 [ ACC ] STREAM LISTENING 239449 6293/mysqld /opt/lampp/var/mysql/mysql.sock
Sep 12 2016
parent reply Martin Krejcirik <mk-junk i-line.cz> writes:
 # netstat -npl | grep mysql

 unix  2      [ ACC ]     STREAM     LISTENING     239449   
 6293/mysqld          /opt/lampp/var/mysql/mysql.sock
Mysql defaults to unix socket, you need to add bind-address=127.0.0.1 to my.cnf [mysqld] section.
Sep 12 2016
parent Geert <gerndz gmail.com> writes:
On Monday, 12 September 2016 at 15:02:50 UTC, Martin Krejcirik 
wrote:
 # netstat -npl | grep mysql

 unix  2      [ ACC ]     STREAM     LISTENING     239449   
 6293/mysqld          /opt/lampp/var/mysql/mysql.sock
Mysql defaults to unix socket, you need to add bind-address=127.0.0.1 to my.cnf [mysqld] section.
That didn't work, but thanks anyway. Now is working. I had to comment "skip-networking": # The MySQL server [mysqld] user = mysql port=3306 socket = /opt/lampp/var/mysql/mysql.sock skip-external-locking #bind-address=127.0.0.1 # 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 # (via the "enable-named-pipe" option) will render mysqld useless! # #commented in by xampp security #skip-networking
Sep 12 2016