Comments (6)
tl;dr Not yet, give me a couple of days to thing best way to do it.
Although the link you provide doesn't work, I get the idea. The --protocol option is only useful to force a different type of connection, for example, connecting to localhost by default makes the connection using a socket. If you want to connect using tcp, you then use --protocol=TCP.
Please see:
http://php.net/manual/en/ref.pdo-mysql.connection.php
When the host name is set to "localhost", then the connection to the server is made thru a domain socket.
mysqldmp-php passes the host option directly to the dsn option of the constructor.
https://github.com/ifsnop/mysqldump-php/blob/master/src/Ifsnop/Mysqldump/Mysqldump.php#L194
Unfortunately, there is no way to connect using a socket different from the default one with the current mysqldump-php code.
Changes needed to support connecting through a socket would probably made the next version of mysqldump-php incompatible with the current one. Last option is currently not supported.
mysql:host=localhost;dbname=testdb
mysql:host=localhost;port=3307;dbname=testdb
mysql:unix_socket=/tmp/mysql.sock;dbname=testdb
from mysqldump-php.
Ah, you're right - it was working when I posted. Anyway, the use case would be when the hostname is followed by a custom path : localhost:/tmp/mysql5
, so yes like in your example :)
Right now, we're just parsing the host parameter for a :
and use the part after it for the socket
https://github.com/humanmade/backupwordpress/blob/master/classes/class-backup.php#L805
Adds socket parameter to mysqldump
https://github.com/humanmade/backupwordpress/blob/master/classes/class-backup.php#L866
from mysqldump-php.
Looks like using a DSN string is the best way to handle connection strings to databases. In the end, PDO will take care of it without parsing.
from mysqldump-php.
makes sense
from mysqldump-php.
Please, take a look at the devel branch.
from mysqldump-php.
Everything should be fixed by now.
I will bump version to 2.0 because now the constructor takes a dsn string as a parameter, the same that is needed by PDO to create the connection, and everything is parsed from there. Also now the default filename name equals to stdout, to mimic mysqldump behavoiur.
I rewrote some parts of old code, but didn't tag it yet to 2.0. If more positive comments are made, I will be very happy to improve things.
from mysqldump-php.
Related Issues (20)
- Missing port DSN parsing HOT 1
- We created a new new fork HOT 16
- Can we dump data without structures? HOT 4
- Laravel Integration
- Thank you!
- Change " to ` in CREATE TABLE part HOT 1
- Is it possible to get the output line by line HOT 3
- Memory problem with large tables HOT 3
- Add truncate option
- remove execution tokens option HOT 4
- Version 2.10 returning error 500 with large DB HOT 1
- Not default connection collation HOT 3
- Mysqldump-php generates inconsistent snapshot of Database. HOT 9
- Delete database name on exported triggers HOT 1
- [TLS] no way to specify that connection should use TLS
- Exporting all triggers when using include-tables
- restore error - Mysql 8
- Use an existing PDO connection? HOT 1
- Dumping events is not skipping definer
- Resetting sql_mode on top of sql file breaks import when ANSI_QUOTES was in the original
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysqldump-php.