Mysql's tag archives

Backup mysql database with php and zip

Many php applications prefer to backup the mysql database from within the application and save it as an archive. The mysqldump commandline utility can be used to perform this function of backing up a mysql database as sql file. The command would be like this : The above command shall dump the database named $db_name into a sql file in directory $dir. This sql file shall be next zipped using php's Ziparchive class. In the above example backups/backup.sql is the path to the sql fil...

MySQL Optimize Top 21 Tips

1. Optimize Your Queries For the Query Cache Most MySQL servers have query caching enabled. It’s one of the most effective methods of improving performance, that is quietly handled by the database engine. When the same query is executed multiple times, the result is fetched from the cache, which is quite fast. The main problem is, it is so easy and hidden from the programmer, most of us tend to ignore it. Some things we do can actually prevent the query cache from performing its task. vie...

MySQL group by day, month or year

Using the DATE_FORMAT operator, you can easily group the timestamp, date or datetime column using any format you want. For example, I needed to group rows that were added on the same day. Here is my query: This query will give you result like this : Group by month: Group by year:

Create web server on Mac

Apache Start Apache Check it's working: http://localhost/ PHP In /etc/apache2/httpd.conf, uncomment this line: Restart Apache Fix a warning appearing in phpinfo() Create /etc/php.ini and make it writable In php.ini, find this line: Uncomment it and insert your time zone (http://php.net/manual/en/timezones.php) Restart Apache MySQL Download the MySQL package for Mac OS X.5 (32 or 64 bits depending on your machine) Install everything in...

Using mysql to replace word in database

Table:mt-entry subject: entry_text search:abc replace:def