Due to the different versions of MySQL, there will be different installation methods. Under the Linux system under the MySQL5.1.19 version for example, to install, beginners also look correct.
First, install the compilation software (simple Yum installation)
Gcc
Gcc-c++
Ncurses
Ncurses-devel
CMake
Second, modify hosts to resolve host names
echo "127.0.0.1 ' hostname '" >>/etc/hosts
Three, compile and install
# tar xvf mysql-5.5.19.tar.gz
# cd mysql-5.5.19
# cmake.-dcmake_install_prefix=/usr/local/mysql \
-dmysql_datadir=/usr/local/mysql/data \
-dmysql_unix_addr=/usr/local/mysql/tmp/mysql.sock \
-DDEFAULT_ Charset=utf8 \
-ddefault_collation=utf8_general_ci \
-dextra_charsets=gbk,gb2312,utf8,ascii \
-DENABLED_ Local_infile=on \
-dwith_innobase_storage_engine=1 \
-dwith_federated_storage_engine=1 \
-DWITH_ blackhole_storage_engine=1 \
-dwithout_example_storage_engine=1 \
-dwithout_partition_storage_engine=1 \
-dwith_fast_mutexes=1 \
-dwith_zlib=bundled \
-denabled_local_infile=1 \
-dwith_readline=1 \
- dwith_embedded_server=1 \
-dwith_debug=0
# make && make install
Iv. Generating configuration files
# CP/ROOT/MYSQL-5.5.19/SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNF
# VIM/ETC/MY.CNF
[Mysqld]
DataDir =/usr/local/mysql/data
V. Create a new user to run MySQL
# Groupadd MySQL
# Useradd-r-G mysql-s/sbin/nologin MySQL
Vi. initialization
#/home/mysql-5.5.19/scripts/mysql_install_db \
--basedir=/usr/local/mysql/\
--datadir=/usr/local/mysql/data--user=mysql
Vii. modifying MySQL directory permissions
# Chown-r Root.mysql/usr/local/mysql
# Chmod-r 777/usr/local/mysql/data
Eight, start MySQL
#/usr/local/mysql/bin/mysqld_safe--user=mysql &
IX. Export Startup program
# Cp/home/mysql-5.5.19/support-files/mysql.server/etc/init.d/mysqld
# Chymod +x/etc/init.d/mysqld
# chkconfig--add mysqld
# service Mysqld Start
X. Export the MySQL login program
# ln-s/usr/local/mysql/bin/mysql/usr/bin/mysql
Ps:
Log in to MySQL:
/usr/bin/mysql-u root-p Password
Install MySQL Summary