Compile and install MySQL 5.5 under Debian 6.02 of squeeze

  • 2020-05-12 06:18:24
  • OfStack

Environment: Debian 6.02 (squeeze) x64
Software: MySQL 5.5.14
Steps:
1. Upgrade the system
#apt-get update

#apt-get upgrade

#apt-get install chkconfig libpcre3-dev build-essential libssl-dev libncurses5-dev bison
2. Prepare software
cmake 2.8.5, mysql 5.5.14
#wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz

#wget ftp://mirror.anl.gov/pub/mysql/Downloads/MySQL-5.5/mysql-5.5.14.tar.gz
3, installation,
1) install cmake
#tar zxvf cmake-2.8.5.tar.gz

#cd cmake-2.8.5/

#./configure

#make && make install
2) add mysql users
groupadd mysql

useradd --shell /sbin/nologin -g mysql mysql
3) install mysql
#tar zxvf mysql-5.5.14.tar.gz

#cd mysql-5.5.14

#cmake \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/data/mysql \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=all \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_TCP_PORT=3306

#make && make install
4) change installation folder permissions
#chown -R mysql:mysql /usr/local/mysql/

#chown -R mysql:mysql /usr/local/data/mysql
5) initialization words
#sh scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/data/mysql --user=mysql
6) copy mysql configuration file and generate startup script
#cp support-files/my-medium.cnf /etc/my.cnf

#cp support-files/mysql.server /etc/init.d/mysqld
7) set it to start from scratch
#chmod 755 /etc/init.d/mysqld

#chkconfig mysqld on
8) setting environment variables
#nano /etc/profile
Add the following
export PATH=/usr/local/mysql/bin:$PATH

alias mysql_start="mysqld_safe &"

alias mysql_stop="mysqladmin, u root -- p shutdown"
4. Start the test
#service mysqld start

# / usr local/mysql/bin/mysql - uroot � p
5. Password and security configuration
#/usr/mysql/bin/mysql_secure_installation

Related articles: