Installing things from tarballs is a common practice on UNIX/Linux systems. You'll be doing it later when you install DBI as well. By then you'll be a pro. It usually involves just a few simple steps. Tarballs usually come as compressed, tar'd files. tar stands for Tape Archive, and refers to a format for storing and archiving files and directory structures. When you unpack a tar ball it recreates the original directory structure and files.
The binary source tarball comes with everything you need to run MySQL, as well as all the client programs for interacting with the database, and the development libraries for writing or using your own programs with the database. To install the software you should be able to log into your system as root. By default, mysql would run as a root process, and some of the files would be owned by root. Because this is something of a security risk, many people choose to create a regular user for running the mysql deamon. This way there are less root owned files on your system, and fewer opportunities for exploiting a root owned process. Once you have the software, and created a user, you can install the database and start it up. The last steps are simply to set an administration password, and then modify your system so that it starts the mysql deamon everytime the system is started.
A common place to install software on linux systems is in the directory:
/usr/local/
Once you have the software, log in as root and move the tarball to that directory. The filename of the software will have two extenions on the end: .tar.gz The gz indicates that the file is compressed. To uncompress the file issue the command:
gunzip filename.tar.gz
this will decompress the file and remove the .gz extension. Now you have a true tar file. Unpack it using the tar command with the appropriate arguments:
tar -xvf filename.tar
the x means extract, the v means verbose (show me everything that's happening), and the f indicates that the next argument is the filename to extract. You should see the names of files and directories wizzing by your screen. If you list the contents of the current directory you should see that a new directory containing all the mysql files has been created.
Now that you have the distribution unpacked, it's a good idea to create the user that will own the files and run the database. You can do this with the adduser command.
Since it has a long clunky name, you should create a symbolic link to it (the same thing as an alias or shortcut):
/usr/sbin/groupadd mysql #create the user mysql with no home directory and group mysql /usr/sbin/adduser mysql -M -g mysqlNow su to user mysql and initialize your database tables. It's important to do this as the user mysql, because otherwise the tables and directories will be created as owned by root
[root@zenith mysql]#su mysql [mysql@zenith mysql]# [mysql@zenith mysql]# scripts/mysql_install_db Creating db table Creating host table Creating user table Creating func table Creating tables_priv table Creating columns_priv table To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! This is done with: ./bin/mysqladmin -u root password 'new-password' See the manual for more instructions. Please report any problems with the ./bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://www.tcx.se/license.htmy. [mysql@zenith mysql-3.22.32-pc-linux-gnu-i686]# |
Now before you can set the root password, you must start the mysqld daemon. This is done with a little script in the scripts directory called safe_mysqld.
[root@zenith mysql-3.22.32-pc-linux-gnu-i686]# bin/safe_mysqld & [1] 1541 [root@zenith mysql-3.22.32-pc-linux-gnu-i686]# Starting mysqld daemon with databases from /usr/local/mysql-3.22.32-pc-linux-gnu-i686/data
You can see if the daemon is running by looking at all the system process:
ps aux | more
Now try setting the root password:
[root@zenith mysql-3.22.32-pc-linux-gnu-i686]# ./bin/mysqladmin -u root password 'friday' |
You can also try connecting to the server and issuing a command:
[root@zenith mysql-3.22.32-pc-linux-gnu-i686]# bin/mysql -pfriday mysql> show databases; +----------+ | Database | +----------+ | mysql | | test | +----------+ 2 rows in set (0.00 sec) mysql> |
[root@zenith support-files]# cp mysql.server mysql.server-dist [root@zenith support-files]# emacs -nw mysql.server [root@zenith support-files]# cp mysql.server /etc/rc.d/init.d/ [root@zenith support-files]# cd /etc/rc.d/init.d/ [root@zenith init.d]# chmod a+x mysql.server [root@zenith init.d]# ls -al mysql.server -rwxrwxr-x 1 root root 2815 Oct 9 2000 mysql.serverWhen your system starts up there is a series of things in rc.d directory that occur. To add mysql as one of the things that gets started use the chkconfig command. Type: man chkconfig for more information on this. Or continuing from above, issue the following comands:
[root@zenith init.d]# /sbin/chkconfig --add mysql.server [root@zenith init.d]# /sbin/chkconfig --list mysql.server mysql.server 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@zenith init.d]#
The first command "chkconfig --add" adds the proper links in the right places for your system to execute the mysql.server script upon system startup. The second command "chkconfig --list" reports back to you the run levels in which the script is executed.
It's also a good idea to add the path to the mysql bin directory to the default path of users. Back to Nomad installation.