Recent Changes - Search:




MySQL Server.

Linux - MySQL Server Downloads.

The complete installation of mysql on a linux server requires the following packages.

          MySQL-server    -- the actual mysql database engine
          MySQL-client    -- the interactive character based mysql client
          MySQL-shared    -- the shared library that mysql needs             
          MySQL-shared-compact    -- for backward compatibility
          MySQL-embedded  -- the embedded mysql library
          MySQL-devel     -- 
          MySQL-bench     -- requires perl and DBD::mysql module
          MySQL-Max       -- includes Innodb tables

The Max package is required if InnoDB or BDB table data file types are to be used in addition to the standard MyISAM table data file type

Please remember to set a password for the MYSQL root USER!

        /usr/bin/mysqladmin -u root password 'new password'
 /usr/bin/mysqladmin -u root -h localhost.localdomain password  'new  password'


On Linux, the grant tables are set up by the mysql_install_db program. Typically, mysql_install_db needs to be run only the first time

             [root@hcl html]# which mysql
             [root@hcl html]# which mysql_install_db

Start the MySQL server:

            mysqld_safe --user=mysql &

Use mysqladmin to verify that the server is running.

           mysqladmin version
           mysqladmin variables

Shut down the server:

          mysqladmin -u root shutdown

Shut down the server:

          mysqld_safe --user=mysql --log &

               [root@hcl ~]# mysqlshow
               | Databases |
               | mysql     |
               | test      |

Retrieve information from the server.

               [root@hcl ~]# mysqlshow mysql
               Database: mysql
               |          Tables           |
               | columns_priv              |
               | db                        |
               | func                      |
               | help_category             |
               | help_keyword              |
               | help_relation             |
               | help_topic                |
               | host                      |
               | tables_priv               |
               | time_zone                 |
               | time_zone_leap_second     |
               | time_zone_name            |
               | time_zone_transition      |
               | time_zone_transition_type |
               | user                      |

Securing the MySQL

               To use SET PASSWORD on Unix, do this: 

              # mysql -u root
              mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
              mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');

              mysql> use mysql;
                 mysql> SELECT Host, User FROM mysql.user;
                 | Host          | User |
                 | |      |
                 | | root |
                 | localhost     |      |
                 | localhost     | root |
                 4 rows in set (0.05 sec)


                 mysql> describe user;

                 mysql> select host,User from user;
                 | host          | User |
                 | |      |
                 | | root |
                 | localhost     |      |
                 | localhost     | root |
                 4 rows in set (0.00 sec)

MySQL Server has built-in support for SQL statements to check, optimize, and repair tables. These statements are available from the command line through the mysqlcheck client. MySQL also includes myisamchk, a very fast command-line utility for performing these operations on MyISAM tables.


     mysql  mysqladmin  mysqlcheck    mysqldump     mysql_find_rows   mysqlshow 
     mysql_waitpid      mysqlaccess   mysqlbinlog   mysql_config  
     mysqlimport        mysql_tableinfo  mysqldumpslow

myisamchk --help

Description, check and repair of MyISAM tables.

-r, --recover Can fix almost anything except unique keys that aren't unique. Used without options all tables on the command will be checked for errors

	Usage: myisamchk [OPTIONS] tables[.MYI]

mysqlcheck --help

This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a) or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be used at the same time.

The option -c will be used by default, if none was specified. You can change the default behavior by making a symbolic link, or copying this file somewhere with another name, the alternatives are:

	mysqlrepair:   The default option will be -r
	mysqlanalyze:  The default option will be -a
	mysqloptimize: The default option will be -o

Usage: mysqlcheck [OPTIONS] database [tables]

	OR     mysqlcheck [OPTIONS] --databases DB1 [DB2 DB3...]
	OR     mysqlcheck [OPTIONS] --all-databases

By default, MySQL creates MyISAM tables with an internal structure that allows a maximum size of about 4GB. You can check the maximum table size for a MyISAM table with the SHOW TABLE STATUS


MaxDB is a heavy-duty enterprise database. MaxDB is the new name of a database management system formerly called SAP DB. MaxDB runs as a client/server system. MySQL can run as a client/server system or as an embedded system.

MaxDB and MySQL are independent database management servers.

How can I backup a MySQL database?

      mysqldump -u $mysqlusername -p$mysqlpassword $mysqldatabasename > backupdb.sql

Not that there is no space after the -p

      mysqldump -u user -p --opt database > backup_dbfilename


       The most normal use of mysqldump is probably for making a backup
       of whole databases. See Mysql Manual section 21.2 Database Back-

       mysqldump  --opt database > backup-file.sql

       You can read this back into MySQL with:

       mysql  database < backup-file.sql


       mysql  -e �source /patch-to-backup/backup-file.sql� database

       However,  it�s also very useful to populate another MySQL server
       with information from a database:

       mysqldump --opt database | mysql --host=remote-host -C database

       It is possible to dump several databases with one command:

       mysqldump  --databases  database1  [ database2 database3... ]  >

       If all the databases are wanted, one can use:

       mysqldump --all-databases > all_databases.sql
Edit - History - Print - Recent Changes - Search
Page last modified on July 05, 2006, at 12:17 AM