Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CentOS6.x install mysql5.6.x

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. System and installation instructions

System: CentOS6.x_x64

mysql: community version 5.6.21, open source database with the most mysql, compilation and installation is more cumbersome, yum installation version is relatively low and the default installation location is/var/, this time using the official download rpm package, through the script automatic installation and custom data directory to a separate partition (this time for/data directory)

2. Prepare the installation package

1> Official download

#https://dev.mysql.com/downloads/mysql/5.6.html#downloads Select the version and platform package:

MySQL-shared-compat-5.6.x-1.el6.x86_64.rpm #x is the version number of your download

MySQL-devel-5.6.x-1.el6.x86_64.rpm

MySQL-shared-5.6.x-1.el6.x86_64.rpm

MySQL-client-5.6.x-1.el6.x86_64.rpm

MySQL-test-5.6.x-1.el6.x86_64.rpm

MySQL-server-5.6.x-1.el6.x86_64.rpm

2> Packages used in this experiment

https://pan.baidu.com/s/1kVraS8R Password: iybx

The following software packages are included:

MySQL-shared-compat-5.6.21-1.el6.x86_64.rpm

MySQL-devel-5.6.21-1.el6.x86_64.rpm

MySQL-shared-5.6.21-1.el6.x86_64.rpm

MySQL-client-5.6.21-1.el6.x86_64.rpm

MySQL-test-5.6.21-1.el6.x86_64.rpm

MySQL-server-5.6.21-1.el6.x86_64.rpm

2> Some of the main directories of mysql database default:

The requested URL/var/lib/was not found on this server.

2. Configuration file/usr/share/mysql (mysql.server command and configuration file)

3. Related commands/usr/bin (mysqladmin mysqldump and other commands)

4. Startup script/etc/rc.d/init.d/(directory of startup script file mysql)

The requested URL/etc/my.cnf was not found on this server.

3. Installation

1> If it is officially downloaded, please directly perform the following operations

#rpm -ivh MySQL-shared-compat-5.6.x-1.el6.x86_64.rpm #Provide basic dependencies, first install required #yum remove mysql-libs -y #mysql-lib#yum install libaio -y #install libiao#rpm -ivh MySQL-devel-5.6.x-1.el6.x86_64.rpm#rpm -ivh MySQL-shared-5.6.x-1.el6.x86_64.rpm#rpm -ivh MySQL-client-5.6.x-1.el6.x86_64.rpm#rpm-ivh MySQL-test-5.6.x-1.el6.x86_64.rpm#rpm -ivh MySQL-server-5.6.x-1.el6.x86_64.rpm Note: The above directory is installed directly under/var/lib/mysql, you can also customize the directory on a partition (disk)

So you can reinitialize the installation to another directory through scripts; complete the customization;

2> Script Execution

#!/ bin/bashsrc_dir=$(pwd)cd $src_dirtar xvf mysql5.6.21.x86_64.rpms.tar.gztar xvf mysql5.6.21.x86_64.rpms.tarcd mysql5.6.21rpm -ivh MySQL-shared-compat-5.6.21-1.el6.x86_64.rpmyum remove mysql-libs -yyum install libaio -yrpm -ivh MySQL-devel-5.6.21-1.el6.x86_64.rpmrpm -ivh MySQL-shared-5.6.21-1.el6.x86_64.rpmrpm -ivh MySQL-client-5.6.21-1.el6.x86_64.rpmrpm -ivh MySQL-test-5.6.21-1.el6.x86_64.rpmrpm -ivh MySQL-server-5.6.21-1.el6.x86_64.rpm #service mysql start && echo "mysql5.6.21 has installes sucess! "#mysql_root_pwd=`gawk -F : '{ print $4 }' /root/.mysql_secret`#echo "A random root password has been set. You will find it in '/root/.mysql_secret'. "#echo "The random root password was:'${mysql_root_pwd// }'" service mysql stop[ -d /data/mysqldb/data ] || mkdir -p /data/mysqldb/data[ -d /data/mysqldb/log ] || mkdir -p /data/mysqldb/logchown mysql.mysql /data/mysqldb -Rcd /usr/bin./ mysql_install_db --user=mysql --basedir=/usr --datadir=/data/mysqldb/data #Migrate data directory to/data/mysqldb/data can customize cd $src_dir cp ${src_dir}/my.cnf /etccd /var/libmv mysql /tmpmkdir mysqlchown mysql.mysql mysql service mysql start & echo "Mysql root password was empty.Please change when you login mysql. "ln -s /data/mysqldb/data/mysql.sock /var/lib/mysql/mysql.sock #Because some mysql tools default to here to find mysql.sock, so make a soft chain

4. Precautions

The root password of mysql service is empty. Please modify the root password yourself. Or add the following line to the script to automatically modify mysql root password after mysql migrates the good directory and starts

mysqladmin -u root password "123456"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report