Thursday, December 16, 2010

Fast setup of a simple MySQL database on Solaris

This assumes that the MySQL software is installed already on your machine e.g. in /usr/sfw/bin on Solaris 10.

The recipe below will create a simple MySQL db on your machine in no time, of course it will be only accessible on your machine (the socket will be local), the data sit in your home directory but it suffices to get a simple db to play with.

The initial setup is easy.
  • Choose a directory e.g. $HOME/mydata where to put the db.
  • Choose a socket e.g. /tmp/my.$USER.sock for the server/client connection.

In a Bourne or Korn shell these 4 commands get the db going:
DATADIR=$HOME/mydata
MYSQL_UNIX_PORT=/tmp/my.$USER.sock
/usr/sfw/bin/mysql_install_db  --datadir=$DATADIR
/usr/sfw/sbin/mysqldb &
and then run the following to connect to the db (like isql in Sybase):
/usr/sfw/bin/mysql
will get you a prompt , do
use test;
which will connect you to the 'test' db and
create table aa (bb int);
will create a table 'aa' with one column 'bb' of type integer.

For more details the use the online ref http://dev.mysql.com/doc/refman/5.0/en/

Have fun, MySQL has a huge number of tuning possibilities, not necessarily though for the beginner or for simple small dbs.

Note: this article was written in 2007 when MySQL 5.0 was hot, I haven't checked with later releases, in particular after Oracle has taken on Sun Microsystems which had acquired MySQL earlier.

3 comments:

  1. myTectra Amazon Web Services (AWS) certification training helps you to gain real time hands on experience on AWS. myTectra offers AWS training in Bangalore using classroom and AWS Online Training globally. AWS Training at myTectra delivered by the experienced professional who has atleast 4 years of relavent AWS experince and overall 8-15 years of IT experience. myTectra Offers AWS Training since 2013 and retained the positions of Top AWS Training Company in Bangalore and India.

    aws training in bangalore

    ReplyDelete
  2. Big Data and Hadoop is an ecosystem of open source components that fundamentally changes the way enterprises store, process, and analyze data.

    hadoop training in bangalore

    ReplyDelete
  3. Harvard Business Review named data scientist the "sexiest job of the 21st century".This Data Science course will cover the whole data life cycle ranging from Data Acquisition and Data Storage using R-Hadoop concepts, Applying modelling through R programming using Machine learning algorithms and illustrate impeccable Data Visualization by leveraging on 'R' capabilities.With companies across industries striving to bring their research and analysis (R&A) departments up to speed, the demand for qualified data scientists is rising.

    data science training in bangalore

    ReplyDelete