1. Install MYSQL Dependent library (if not, install it, do not install it)
by Rpm-qa | grep name verifies that the following packages are all installed.
gcc* gcc-c++* autoconf* automake* zlib* libxml* ncurses-devel* libmcrypt* libtool*
If not, install:
Yum Installation:
#yum Install Bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool
RPM–IVH Installation:
Example: Rpm-ivh mysql-devel-4.0.24-0.i386.rpm
2. Install the CMake package
# wgethttp://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
# tar ZXVF cmake-2.8.6.tar.gz
# CD CMAKE-2.8.6/
#./configure
# Gmake
# gmake Install
3. adding users and creating database directories and permission settings
# group Add MySQL
#useradd mysql–g MySQL
# mkdir-p/data/mysql
# Chown-r Mysql:mysql/data/mysql
4.MYSQL 5.5.22 Installation
#cd/USR/LOCAL/SRC
# wget http://down1.chinaunix.net/distfiles/mysql-5.5.22.tar.gz
# tar ZXVF mysql-5.5.22.tar.gz
# CD mysql-5.5.22
# cmake-dcmake_install_prefix=/usr/local/mysql-dsysconfdir=/etc-dmysql_datadir=/mysql/data-dmysql_tcp_port=3306 -dmysql_unix_addr=/tmp/mysqld.sock-dmysql_user=mysql
# Gmake
# gmake Install
5. setting up the MysQL configuration file
# Cd/usr/local/mysql
# CP./support-files/my-huge.cnf/etc/my.cnf
5.1 Edit/etc/my.cnf
# VI/ETC/MY.CNF
Increase in [mysqld] Segment
DataDir =/data/mysql
Wait-timeout = 30
Max_connections = 512
Max_connect_errors = 10000000
Default-storage-engine = MyISAM
Modify in [mysqld] section
Max_allowed_packet = 16M
[Mysqld_safe] Add Field
Log-error=/data/mysql/log/mysqld.log
6. Initializing the database
#cd/usr/local/mysql
# 9./scripts/mysql_install_db--datadir=/data/mysql--basedir=/usr/local/mysql--defaults-file=/etc/my.cnf--user= Mysql
# CP./support-files/mysql.server/etc/rc.d/init.d/mysqld
# chmod 755/etc/rc.d/init.d/mysqld
# chkconfig--add mysqld
# chkconfig--level mysqld on
7. set Startup script variables
Edit/etc/rc.d/init.d/mysqld
# Vi/etc/rc.d/init.d/mysqld
Basedir=/usr/local/mysql
Datadir=/data/mysql
8. setting the variable environment
# echo "path= $PATH:/usr/local/mysql/bin" >>/etc/profile(permanent)
# Export path= $PATH:/usr/local/mysql/bin(currently in force)
Or
# . /etc/profile
9. Start the service
# service Mysqld Start
Set database administrator root password restart mysqld service
# mysqladmin-u root password ' 123456 '
# Service Mysqld Restart
To view the MySQL service:
[Email protected] data]#netstat-npalt | grep 3306
TCP 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 25051/mysqld
View MySQL Process
[Email protected] data]#ps-ef | grep "MySQL "
Root 24737 1 0 08:04 pts/1 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe--datadir=/data/mysql--pid-file=/da Ta/mysql/tata.domain.pid
MySQL 25051 24737 0 08:04 pts/1 00:00:00/usr/local/mysql/bin/mysqld--basedir=/usr/local/mysql--datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/tata.domain.err--pid-file=/data/ Mysql/tata.domain.pid--socket=/tmp/mysqld.sock--port=3306
Root 25130 2648 0 08:24 pts/1 00:00:00 mysql-u root-p
Root 25183 9149 0 08:34 pts/2 00:00:00 grep mysql
Go to MySQL .
# mysql-u Root-p
Enter password
mysql> show databases;
+-----------------------+
| Database |
+-----------------------+
| Information_schema |
| MySQL |
| #mysql50 #mysql-5.5.22 |
| Performance_schema |
| Test |
+-----------------------+
5 rows in Set (0.00 sec)
mysql> use MySQL;
Database changed
Mysql> Show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| Columns_priv |
........
manage MySQL, build tables, build libraries
Show MySQL storage engine
mysql>showengines;
Encoding change
Show variables like ' character_set_% ';
Setcharacter_set_client=utf8;