Beginning PostgreSQL
As a MySQL user for a number of years I needed a translation tutorial from MySQL to PostgreSQL. So to get started on CentOS: Installation yum install postgresql-server If you also want the phpPgAdmin WUI: yum install phpPgAdmin php-pgsql httpd Create the configuration file and initialise the database: cp /usr/share/pgsql/postgresql.conf.sample /var/lib/pgsql/data/postgresql.conf /etc/init.d/postgresql initdb Make changes [...]
Continue ReadingLAMP Performance
The following scripts can help in determining good values for Apache and MySQL configurations based on the amount of memory available: MySQL Tuner Apache Tuner Apache Buddy The following will giveĀ a list of Apache Modules loaded: apachectl -t -D DUMP_MODULES The following will give the memory usage of Apache: #!/bin/sh # apache_mem.sh # Calculate [...]
Continue ReadingLAMP on Ubuntu
There are several different commands that can be used to install Apache and MySQL services with PHP support: sudo apt-get install tasksel && sudo tasksel sudo apt-get install lamp-server^ sudo apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-curl mysql-client mysql-server libmysqlclient15-dev phpmyadmin For number two the carat at the end is important.
Continue ReadingMySQL Proxy
Today I wanted to create a straight-forward MySQL Proxy service which would forward MySQL queries from a development machine to another live server which was running MySQL. The aim was to allow people on the development machine to use the same connection string as on the live server, specifying the MySQL host as localhost but [...]
Continue ReadingMySQL query output to text or CSV
I needed to output the results of a MySQL query today for further analysis and found the answer here. For future reference… SELECT * FROM errors WHERE mailfrom LIKE ‘a.n.other%’ INTO OUTFILE ‘/tmp/a.n.other.txt’ FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’; It is also possible to enclose the fields with quotes using: ENCLOSED BY ‘”‘
Continue ReadingMySQL: Too Many Connections
On a shared server with MySQL and Apache the MySQL server was periodically disallowing connections as there were already too many connections. The default is 150+1 so I added the following to /etc/my.cnf max_connections=200 To increase the maximum number of connections to 200+1
Continue ReadingSet MySQL to Read-Only
For a backup server which we may want to run as read-only for short maintenance periods the following may be useful.Method 1: Global read_onlyLogin to MySQL and set the read_only setting to true: mysql -u root -pset GLOBAL read_only = true; To unset this run: set GLOBAL read_only = false; Method 2: Read LockAnother method [...]
Continue Readingmysqldump
Basic Usage: mysqldump -u root -pSECRET –quote-names –databasesĀ mydatabasename > mydatabasename.sql If find it best to include the –databases switch as this will add the ‘DROP DATABASE’ and ‘CREATE DATABASE’ statements when restoring – proceed carefully.Quote Names:Quoting the file names can be an insurance against users who may have created field names with spaces in [...]
Continue ReadingMySQL 4 to MySQL 5 Character Sets and Collation
Moving from MySQL 4 to MySQL 5 caused a few issues on Joomla websites. The problems stem from MySQL 4 using latin1 swedish as default but some applications like Joomla want utf8 so:1. Re-export the database (it is Ok to do this from the existing MySQL 5 database): mysqldump -u username -p –default-character-set=latin1 –compatible=mysql40 dbname [...]
Continue ReadingMySQL 4 to MySQL 5 Character Sets and Collation
Moving from MySQL 4 to MySQL 5 caused a few issues on Joomla websites. The problems stem from MySQL 4 using latin1 swedish as default but some applications like Joomla want utf8 so:1. Re-export the database (it is Ok to do this from the existing MySQL 5 database): mysqldump -u username -p –default-character-set=latin1 –compatible=mysql40 dbname [...]
Continue Reading
Recent Comments
Thanks - worked for me....
30 days agoyou can use partprobe command to eliminate the need for reboot....
51 days agoThanks alot for this simple and solid post....
56 days agoI'm using this company services (ssl2buy) since long and purchased man...
56 days ago