Red Hat / Fedora Core RPM Packages
Red Hat / Fedora Core RPM Packages
Red Hat / Fedora Core RPM Packages
mysql-VERSION.i386.rpm (Required)
mysql-server-VERSION.i386.rpm (Required)
mysqlclient9-VERSION.i386.rpm (Shared object libraries)
mysql-devel-VERSION.i386.rpm (C include files and libraries for
software developers)
php-mysql-VERSION.i386.rpm (For accessing MySQL database from
php)
[Potential Pitfall]: Your system should have a host name other than the
default "localhost". Give your systems a host name if you get the
following installation error:
ERROR: 1062 Duplicate entry 'localhost-root' for key 1
ERROR: 1062 Duplicate entry 'localhost-' for key 1
Notes:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/var/lib
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Post installation:
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
[prompt]$ quit
Security:
Security and database access is controlled by the GRANT tables.
Access to connect to the database and access to process the
transaction (table and column access, etc.) are both required. Privileges
are searched in the following order:
1. user table
2. db and host table
3. tables_priv
4. columns_priv
or (more promiscuous)
mysql> GRANT ALL PRIVILEGES on *.* to david@'%' identified by 'david';
mysql> FLUSH PRIVILEGES;
You will be prompted to enter the old root password to complete this
command.
or:
or:
[Potential Pitfall]: It is very easy to make mistakes which get entered into
important tables. If you enter the command twice you may have one incorrect
and one correct entry. Look at the table data after a mistake to see what
happened in case it needs to be fixed.
Example:
[Potential Pitfall]: Any changes (UPDATE) to the user table will require a "FLUSH
PRIVILEGES" before the changes will be effective.
Disabling networking:
If your configuration is a web server interacting with a mySQL database running on the
same "localhost" then one may turn off network access to tighten security. Edit shell
script:
/usr/bin/safe_mysqld (FedoraCore 3)
/usr/bin/mysqld_safe (Red Hat Enterprise Linux 4)
..
...
if test -z "$args"
then
$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION \
--datadir=$DATADIR $USER_OPTION --pid-file=$pid_file \
--skip-networking --skip-locking >> $err_log 2>&1
else
eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults
--basedir=$MY_BASEDIR_VERSION \
--datadir=$DATADIR $USER_OPTION --pid-file=$pid_file \
--skip-networking --skip-locking $args >> $err_log
2>&1"
fi
...
..
bind-address = 127.0.0.1
...
...
Restart the database after making changes.
Statistics: [prompt]$ mysqladmin version
List database environment: [prompt]$ mysqladmin variables
Show if database is running: [prompt]$ mysqladmin ping
Show databases available:
[prompt]$ mysqlshow
+-----------+
| Databases |
+-----------+
| bedrock |
| mysql |
| test |
+-----------+
OR
+----+------+-----------+----+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+----+---------+------+-------+------------------+
| 15 | root | localhost | | Query | 0 | | show processlist |
+----+------+-----------+----+---------+------+-------+------------------+
[prompt]$ cd sql-bench
[prompt]$ run-all-tests
or
[prompt]$ mysql -vvf test < ./tests/auto_increment.tst
Sample SQL:
Loading Data:
Dump/Backup/Transfer Database:
Option Description
-A Dump all the databases.
--all-
databases
-B Dump the specified databases.
--databases
-h Specify host to connect to.
--host=
-p Specify password. If you do not specify a password, then you will
--password= be queried.
-u Specify user. Defaults to current user logged in.
--user=
Same as: --add-drop-table --add-locks --all --extended-insert
--opt
--quick --lock-tables
--add-drop- Add a "drop table" SQL statement before each "create" SQL
table statement.
--add-locks Add "lock" SQL statements around "insert" SQL statements.
-a Include all mySQL specific SQL "create" options.
--all
-e Allows utilization of the new, much faster INSERT syntax.
--extended- Database you are migrating to must support this notation.
insert
-q Don’t buffer query, dump directly to stdout.
--quick
-l Lock all tables for read.
--lock-tables
-? Display command line options.
--help
Examples:
Man Page:
mysqldump
Upgrading to 4.1:
Upgrading mySQL to 4.1 from 3.23
Use the command: mysql_fix_privilege_tables --password=root-password
This allows you to use the new GRANT command.
mysql -h host-name -u user-id -psupersecretpassword < total-db-dump-
file.sql
mysql database-name -h host-name -u user-id -psupersecretpassword < db-
dump-file.sql
System Notes:
[Potential Pitfall]: Ubuntu mysql 5.0 database migration - When migrating the
mysql database by copying files
from /var/lib/mysql/... and/etc/mysql/... from one system running Ubuntu
6.11 to 8.04, I got nebulous error message in /var/log/syslog. The root cause
of the problem wasapparmor. If turing off apparmor (/etc/init.d/apparmor stop)
allows your database to start and function properly, then go fix your apparmor
security rules in /etc/apparmor.d/usr.sbin.mysqld. Also note that you must use
the newer script /etc/mysql/debian-start from release 8.04 after
copying/etc/mysql/....
Prerequisites:
Configure:
--password=supersecret
--port=3306
--socket=/opt/tmp/mysql.sock
--no-auto-rehash
Commands/Man pages:
Server:
mySQL Workbench [dev]
Webyog
phpMyAdmin - Web based
Links:
MySQL.com:
o MySQL reference manual
o MySQL developers manual
GeekGirls.com: Database basics