install mySQL on RHEL 32bit

3 ways to install mysql


  1. # yum install mysql mysql-server

  2. # rpm -ivh MySQL-client-5.6.23-1.linux_glibc2.5.i386.rpm MySQL-server-5.6.23-1.linux_glibc2.5.i386.rpm

  3. install by binary file (may need to install cmake gcc gcc-c++ ncurses first):

    a. # tar xvf mysql-5.6.23.tar.gz -C /usr/src

    b. # cd /usr/src/mysql-5.6.23

    c. # cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DENABLED_LOCAL_INFILE=ON

    d. # make j2

    e. # make install

note: options of cmake please refer to official docs


after installation, set up the configuration files (if use default configuration, jump to start mysql and set up password).

# vim /etc/my.cnf

[mysqld]
datadir=/data
user=mysql
socket=/data/mysqld.sock
skip-name-resolve
port=3306
log-bin=/data/mysqld-bin
log-bin-index=/data/mysql-bin
server-id=1

[mysqld_safe]
log-error=/data/mysqld.err
pid-file=/data/mysqld.pid


make directory and initiate

# rm -rf /data
# mkdir /data

# cd /usr/local/mysql
# ./scripts/mysql_install_db --datadir=/data --user=mysql


start mysql and set up password

# mysqld_safe --defaults-file=/etc/my.cnf &
or
# cp ./support-files/mysql.server  /etc/rc.d/init.d/sql
# chmod 755 /etc/rc.d/init.d/sql
# service sql start


# mysqladmin -u root -S /data/mysqld.sock password ‘123‘
# mysqladmin -u root -h 127.0.0.1 -P 3306 password ‘123‘
or
# ln -s /data/mysqld.sock /tmp/mysql.sock
# mysql_secure_installation
# rm -rf  /tmp/mysql.sock


login mysql

# mysql -u root -S /data/mysqld.sock 

or

# mysql -u root  -h 127.0.0.1 -P3306


郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。