PHP Classes

PHP MySQL Shell: Execute MySQL queries from the command line shell

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 211 All time: 8,359 This week: 455Up
Version License PHP version Categories
mysqlshell 1.0.0Free For Educatio...5PHP 5, Databases, Console
Description 

Author

This class can execute MySQL queries from the command line shell.

It can connect to a MySQL server running on a given host and reads SQL queries that the user can enter on the command line so it can execute them.

The class outputs the query results by dumping the query result rows as arrays to the console output.

If the user enters the command "exit", the class will exit and stops processing the SQL queries entered by the user.

Innovation Award
PHP Programming Innovation award nominee
July 2019
Number 5
MySQL is a very popular SQL database server used by many PHP applications. The client program, when available, can be started from the command line console and it allows you to perform any SQL queries on a given database.

This package provides a pure PHP based alternative to the MySQL client program if for some reason it is not available on the computer from which you want to perform the database queries you want to try.

Manuel Lemos
Picture of Dev Sharma
  Performance   Level  
Name: Dev Sharma <contact>
Classes: 4 packages by
Country: India India
Innovation award
Innovation award
Nominee: 2x

Example

<?php

require_once 'shell.class.php';

$db = new Shell('localhost', 'username', 'pass', 'database name', 3306);
$db->shell();
?>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file example.php Example Just an example file
Plain text file shell.class.php Class The main class

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:211
This week:0
All time:8,359
This week:455Up
User Comments (1)
There is `mysql` command at the CLI-level.
5 years ago (Alexander Ivanou)
12%Star