"Tutorial topic": compiling and installing Mysql and management
"Course recording": Gen E
"Main Content"
"1 " what is mysql
my mysql ab mysql is widely used in internet mysql Span style= "font-family: Microsoft Jacob Black;" > as a Web site database.
" 2 the installation My SQL
First, Installation Introduction
user name:mysql
installation directory:/usr/local/mysql-5.5
Database directory:/data/mysql/data
SOURCE Bundle:mysql-5.5.28.tar.gz
Second, installation preparation
Add User
Useradd-s/sbin/nologin MySQL
Create the desired directory
Mkdir-p/data/mysql/data
Chown-r Mysql:mysql/data/mysql
install the required files or programs for compiling
Yum install gcc gcc-c++ cmake ncurses-devel Bison
Download the source package
http://sourceforge.net/projects/mysql.mirror/files/MySQL%205.5.28/
wget http://ncu.dl.sourceforge.net/project/mysql.mirror/MySQL%205.5.28/mysql-5.5.28.tar.gz
third, compile and install
CD
tar xzvf mysql-5.5.28.tar.gz
CD mysql-5.5.28
Cmake-dmysql_user=mysql-dcmake_install_prefix=/usr/local/mysql5.5-dinstall_datadir=/data/mysql/data-dmysql _unix_addr=/tmp/mysqld.sock-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra_charsets=all-dwith _embedded_server=1-denabled_local_infile=1-dwith_myisam_storage_engine=1-dwith_innobase_storage_engine=1
parameter Description :
-dcmake_install_prefix=/usr/local/mysql// installation directory
-dmysql_datadir=/usr/local/mysql/data// Database storage directory
-dwith_myisam_storage_engine=1// install MYISAM storage Engine
-dwith_innobase_storage_engine=1// install innodb storage Engine
-dwith_archive_storage_engine=1// install ARCHIVE storage Engine
-dwith_blackhole_storage_engine=1// install blackhole storage Engine
-denabled_local_infile=1// allow import of data from local
-ddefault_charset=utf8 // using UTF8 characters
-ddefault_collation=utf8_general_ci// check character
-dextra_charsets=all // Install all extended character sets
-dmysql_tcp_port=3306//mysql listening Port
-dmysql_user=mysql//mysql user name
Other parameters :
-dwith-embedded_server=1// compiled into EMBEDDED MySQL Library (libmysqld.a)
-dsysconfdir=/etc//mysql matching file
-dmysql_unix_addr=/tmp/mysqld.sock//unix Socket file path
-dwith_readline=1// shortcut key function
-dwith_ssl=yes//ssl
-dwith_memory_storage_engine=1// install memory storage Engine
-dwith_federated_storage_engine=1// install frderated storage Engine
-dwith_partition_storage_engine=1// Install database partition
-dinstall_plugindir=/usr/local/mysql/plugin// plugin file and configuration path
Make && make install
chown-r mysql:mysql/usr/local/mysql5.5/
mv/root/mysql-5.5.28/support-files/my-large.cnf/etc/my.cnf
Mv/root/mysql-5.5.28/support-files/mysql.server/etc/init.d/mysqld
chmod a+x/etc/init.d/mysqld
Turn on Start
chkconfig--level 345 mysqld on
Setting Environment Variables
echo "Export path=/usr/local/mysql5.5/bin/: $PATH" >>/etc/profile
Source/etc/profile
/usr/local/mysql5.5/scripts/mysql_install_db--user=mysql--defaults-file=/etc/my.cnf--basedir=/usr/local/ mysql5.5--datadir=/data/mysql/data
vim/etc/my.cnf
basedir=/usr/local/mysql5.5
Datadir=/data/mysql/data
Create MySQL Administrator
/usr/bin/mysqladmin-u root password ' z '
To connect to a database:
mysql-u root-p - P Port