Tuesday, May 18, 2010

MySQL - Installation layout

The installation layout of the directory is as shown in the following table:


Directory Contents of Directory
bin Client programs and the mysqld server
data Log files, databases
docs Manual in Info format
include Include (header) files
lib Libraries
man Unix manual pages
mysql-test MySQL test suite
scripts Contains the mysql_install_db script
share/mysql Error message files
sql-bench Benchmarks
support-files Scripts and sample configuration files
/tmp/mysql.sock The location of the MySQL Unix socket

During the package installer process, a symbolic link from /usr/local/mysql to the version/platform specific directory created during installation will be created automatically.

MySQL - Troubleshooting - Can’t connect to local MySQL server through socket /tmp/mysql.sock

Yesterday is a big trouble and very urgent. Do not know why, the are conflict in processing when my previous version for mysql is still running and cannot being kill. It conflict in --port=3306 so the website cannot find the socket.

0:01.14 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql --log-error=/usr/local/mysql/data/mdce1corpsvr03.xxx.com.my.err --pid-file=/usr/local/mysql/data/mdce1corpsvr03.xxx.com.my.pid --socket=/var/mysql/mysql.sock --port=3306


I detect it when check it out :

ps xa | grep mysql

ps -aef | grep mysql

the we can check it using:

netstat -ln | grep mysql

What I am doing yesterday is:

kill - 9 PIDNo - cannot
kill -15 PIDNo - the server restarted

so no others choice.

1. first and important - BACKUP the database first!!! and copy in /users/admin folder

mysqldump -p [db name] > [backup.dmp]
 
2. remove the previous version that disturbing the process

sudo rm -rf /usr/local/mysql*

3. install new version of mysql
4. relink the socket

sudo ln -s /var/mysql/mysql.sock /tmp/mysql.sock


5. create and restore the database using mysqldump

mysql> CREATE database xxxxa;
mysql -u #username# -p #xxxxa# < #backup.dmp#

6. set password for -u root

$ mysqladmin -u root password NEWPASSWORD

7. change database name at dbconnect.php



Refering to  :

Info
mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation.

The mysqld program has many options that can be specified at startup. For a complete list of options, run this command:

shell> mysqld --verbose --help 

When connecting to a MySQL server located on the local system, the mysql client connects thorugh a local file called a socket instead of connecting to the localhost loopback address 127.0.0.1. For the mysql client, the default location of this socket file is /tmp/mysql.sock.
 
Link :
http://dev.mysql.com/doc/refman/5.1/en/mysqld.html
http://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/

Uninstalling MySQL on Mac OS X Leopard

To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:
  • Use mysqldump to backup your databases to text files!
  • Stop the database server
  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
The last two lines are particularly important as otherwise, you can't install an older version of MySQL even though you think that you've completely deleted the newer version!

Link :

http://akrabat.com/computing/uninstalling-mysql-on-mac-os-x-leopard/
http://obscuredclarity.blogspot.com/2009/08/uninstall-mysql-on-mac-os-x.html

Unix Post-Installation Procedures

Link :  http://dev.mysql.com/doc/refman/5.1/en/unix-post-installation.html


Starting and Troubleshooting the MySQL Server

Link : http://dev.mysql.com/doc/refman/5.1/en/starting-server.html


How to Protect or Change the MySQL Unix Socket File

Link : http://dev.mysql.com/doc/refman/5.1/en/problems-with-mysql-sock.html - I am not trying this yet.

Monday, May 10, 2010

Lyrics - Gunka Song

This is a Malay song which uses the Gunka song. Aikoku Koushinkyoku is the original track.
It was a famous song taught by Japanese soldiers when they occupied Malaya in 1940s. It was taught to school students. So, some people in Malaysia from the older generation could speak a bit of basic Japanese. Therefore, this song shows evidence of Japanese influence in Malaysian culture.

Miyo toukai no sora akete
Kyoku jitsu takaku kagayakeba
Tenchi no seiki hatsuratsu to
Kibou wa odoru oyashima

Kami tiga sahabat
nasib timbul tenggelam
Susah hanya sekejap
senang pun tak lama ....

No wonder that P.Ramlee, AR tompel, ibrahim din sing it with the amazing pronunciation.

Refer/Link : http://www.youtube.com/watch?v=NdQpSdaOFnA