If you want to modify the MySQL configuration in MAMP, just create the my.cnf file by the following command Continue reading MAMP – Where is the MySQL config file/my.cnf?
When i try to import a database, the following error is thrown and the import fails.
- Warning: MySQL server has gone away query: INSERT xxx…
Export a database which is called Test:
mysqldump -u <username> -p Test > Test.sql
The sql file will be generated after you input the password. Continue reading MySQL – Import and Export Database with mysqldump
Sometimes we need to convert the selected data into other content type. Here is an example.
Assume we got a table with a VARCHAR column which stores number only.
mysql> SELECT * FROM demo; +----------+ | a_string | +----------+ | 1 | | 2 | | 3 | | 4 | | 5 | | 6 | | 7 | | 8 | | 9 | | 10 | | 11 | | 12 | | 13 | +----------+ 13 rows in set (0.00 sec)
MAMP is Apache, MySQL and PHP runs on Mac. For Mac users, it is very convenient to use the MAMP package such that they don’t need to install the those application one by one. Moreover, MAMP package also bundled with some other useful programs as well as libraries such as phpMyAdmin and the PHP GD library. For more information, you can refer to the MAMP website.
During the installation, you can include the MAMP control panel into you Mac Dashboard. This is quite helpful for you to start and stop the server. you can also pick either PHP4 or PHP5 by switching to the back panel by clicking the i button which is located under the Apache label on the front panel.
Continue reading MAMP – Introduction
I found a good article which the author shows you how to select random records from table among different kind of databases.
Here are the example for SQLite, MySQL and PostgreSQL.
Continue reading SQL – Select Random Records From Table
Remember about the PHP form which inserts the entry to database after form submission? Simple PHP + MySQL form with radio button and dropdown list
Continue reading PHP – Redirect URL After Form Submission
First, create a MySQL database with the following table Continue reading Simple PHP + MySQL form with radio button and dropdown list
By default, the auto commit property of the database connection is set to true. So if you want to rollback the transaction in case there is an exception, you have to set the auto commit to false.
Continue reading JDBC – Java Database Connectivity @ 3