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?
Tag Archives: MySQL
MySQL – MySQL server has gone away
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…
MySQL – Import and Export Database with mysqldump
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
MySQL – Data Type Conversion
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 – Introduction
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
SQL – Select Random Records From Table
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
PHP – Redirect URL After Form Submission
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
Simple PHP + MySQL form with radio button and dropdown list
First, create a MySQL database with the following table Continue reading Simple PHP + MySQL form with radio button and dropdown list
JDBC – Java Database Connectivity @ 3
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