Posted by nick on May 8, 2011 at 3:05 pm
I was in need of a source containing all cities in the united states for my new personal web project. I found this source http://www.populardata.com/zipcode_database.html , but quickly found that it was missing many entries (it has 43,000 cities). However, after more searching I came across this source http://www.maxmind.com/app/worldcities that has call cities in the world listed by country and state. They have 142,000 cities listed for the United States and is much more complete.
Continue Reading
Posted by nick on March 22, 2011 at 2:06 pm
Below is how to set your server’s timezone to UTC or any other offset without using the time zone name from the mysql time_zone tables. In the my.cnf file just below [mysqld] , specify the offset from UTC like
default-time-zone = ‘+00:00′
Continue Reading
Posted by nick on December 15, 2010 at 10:12 am
I just switched over from using windows for years to a mac. I installed Zend Server CE and when working with phpMyAdmin I needed to increase the upload limit in the php.ini file again so I could import a database. I modified the post_max_size and upload_max_filesize then restarted apache as I’ve done in the past. Phpmyadmin still said 2048kb max file size for the import. I finally found the solution here http://stackoverflow.com/questions/3958615/import-file-size-limit-in-phpmyadmin . Apparently phpMyAdmin is running under Lighttpd and has it’s own php.ini file located here /usr/local/zend/gui/lighttpd/etc/php-fcgi.ini . Modify the post_max_size and upload_max_filesize values in that file then restart apache. See my post on how to restart Zend Server CE apache on Mac OS X.
Continue Reading
Posted by nick on May 25, 2010 at 10:37 pm
By default, MySQL is enabled with strict_mode ON, which will most likely cause problems with older PHP applications written for MySQL 4. For example, strict mode will return an error on insert statements if an empty string is provided where an integer is expected.
You may disable strict mode in one of two ways:
Open your “my.ini” file within the MySQL installation directory, and look for the text “sql-mode”.
Find:
# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
and change to
# Set the SQL mode to strict
sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
or you can run the following in phpMyAdmin
SET @@global.sql_mode= ”;
Continue Reading
Posted by nick on March 31, 2010 at 10:01 am
While there is no “copy database” function for mysql, there is a way to automate the process better than saving a bunch of SQL to a file, then uploading the file. Mysqldump offers a way to copy a database to another existing database on the same server or a remote server. The official documentation is here http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html , although their syntax doesn’t include the required username and password login syntax (if your database server requires a login, I hope).
Use the following on linux –
mysqldump nameofdatabase1 -u root -p | mysql –host=localhost -u root -p -C nameofdatabase2;
You’ll be prompted for the password and you’ll need to enter it twice. If your destination database is remote, then replace localhost with the IP address.
Continue Reading