slam/mysql-php
最新稳定版本:v1.1.0
Composer 安装命令:
composer require slam/mysql-php
包简介
PHP version of mysql cli that comes with MySQL
关键字:
README 文档
README
PHP light version of mysql cli that comes with MySQL.
Why
- You are inside a PHP only environment, like a PHP Docker image
- You need to import a large mysql dump
- You don't have access to the native
mysqlclient
Performance
Speed is exactly the same of the original mysql binary thanks to streams usage.
Supported formats
Usage
The library provides two usages, the binary and the \SlamMysql\Mysql class.
From CLI
$ ./mysql -h
Usage: mysql [OPTIONS]
--host Connect to host [Default: INI mysqli.default_host]
--port Port number [Default: INI mysqli.default_port]
--username User for login [Default: INI mysqli.default_user]
--password Password to use [Default: INI mysqli.default_pw]
--database Database to use [Default: empty]
--socket The socket file [Default: INI mysqli.default_socket]
$ printf "CREATE DATABASE foobar;\nSHOW DATABASES;" | ./mysql
information_schema
foobar
mysql
performance_schema
sys
$ ./mysql --database foobar < foobar_huge_dump.sql
From PHP
$mysql = new \SlamMysql\Mysql('localhost', 'root', 'pwd', 'my_database', 3306, '/socket'); $return = $mysql->run(\STDIN, \STDOUT, \STDERR); exit((int) (true !== $return));
\SlamMysql\Mysql::run accepts any type of resource consumable by fgets/fwrite functions.
Related projects
- ifsnop/mysqldump-php:
mysqldumpbinary port in pure PHP
统计信息
- 总下载量: 24.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-17