Commands to export MySQL database schema, database with data, selective tables, ignoring tables
Category: PHP/MySQL
All content related to PHP and MySQL
MySQL Table Size
Get MySQL table sizes using a query
SQL query results to CSV
Multiple times we get requests in projects to generate reports from database. Below command will be helpful in exporting the MySQL query results directly into CSV (comma separated values) file mysql -h {hostname} -u {username} -p {database_name} -B -e “SELECT code AS ‘Coupon Codes’ FROM salesrule_coupon WHERE rule_id=112” | sed “s/\t/,/g” > /tmp/coupon_code_$(date +%F).csv Above […]
MySQL table schema details
I am mentioning here a quick way to get the table schema format. Steps 1) Login to your database using mysql -u {username} -p -h {host_name> -D {database_name} 2) Execute query SELECT TABLE_NAME AS `Table`, ROW_FORMAT AS `Format` FROM information_schema.TABLES WHERE TABLE_SCHEMA = “{database_name}” 3) Primarily there are two types of format Dynamic and Compact […]
Amazon SNS with Magento 2
Updates [April 15,2023] : I have developed an extension for this, please purchase from link Promotion SMS Extension. In one of my project I had to use AWS SNS service to send an SMS from Magento I am explaining here a basic way to implement the same 1) Refer aws-sdk-php to install AWS SDK Guide […]
Stock configuration using Magento API
In one of my post I explained the basics of SOAP API, please refer Magento SOAP API before proceeding further I am listing here the methods to update Product’s stock related information using SOAP API Hope this is helpful
MySQLi with PHP
Below is the simple PHP script to connect database using mysqli Hope this is helpful.
File Upload in PHP
Hello All, I had to make a custom form for file uploading in PHP, I am explaining here the way to upload a file.
MS SQL with PHP
Below is the simple PHP (>= 7.0.0) script to connect with the MS SQL database Hope this is helpful.
Coupon Codes Generator
I am describing here a way to generate coupon codes with custom configurable parameters. Hope this is helpful.