Wednesday, July 1, 2009

MySQL Notes

pkginfo -x | grep -i mysql
Note: Current version of MySQL is NOT managed by SMF
Steps to Initialization of MySQL:
1. /usr/sfw/bin/mysql_install_db - initializes default DBs & tables
/usr/sfw/bin/mysqladmin -u root password 'abc123'
2. groupadd mysql && useradd -g mysql mysql && echo $?
3. chgrp -R mysql /var/mysql && chmod -R 770 /var/mysql && echo $?
4. installf SUNWmysqlr /var/mysql d 770 root mysql
5. cp /usr/sfw/share/mysql/my-medium.cnf /etc/my.cnf (global configuration)
6. /usr/sfw/sbin/mysqld_safe --user=mysql& - starts MySQL
7. symlink
ln /etc/sfw/mysql/mysql.server /etc/rc3.d/S99mysql
ln /etc/sfw/mysql/mysql.server /etc/rc0.d/K00mysql
ln /etc/sfw/mysql/mysql.server /etc/rc1.d/K00mysql
ln /etc/sfw/mysql/mysql.server /etc/rc2.d/K00mysql
ln /etc/sfw/mysql/mysql.server /etc/rcS.d/K00mysql

Note: MyISAM Tables usually contain at least 3 files:
1. .MYI - Index file
2. .MYD - Data File
3. .FRM - Form file(Describes Table Structure)

Note: Client options specified on command-line override all other instances of the opion.
Order of options/directives to be processed usually resembles the following:
1. /etc/my.cnf - global config file
2. /var/mysql/my.cnf - data-server specific config file
3. ~/my.cnf - user-specific config file
4. command line options

Note: Drop test database using the following syntax: 'drop database test;'
Note: You CANNOT drop the 'mysql' database because it contains the following critical information:
1. list of databases to manage
2. user table
3. privileges table

Note: MySQL creates 2 default users: 'root & anonymous'
Note: The anonymous user matches all unmatched users

Create MySQL User using the following command:
grant all privileges on *.* to 'unixcbt'@'localhost' IDENTIFIED BY 'abc123';

Note: After altering privileges, flush them to take effect using:
flush privileges;

Readers who read this page, also read:

Bookmark and Share My Zimbio