Home » Installation and Configurations of Mysql instance

Installation and Configurations of Mysql instance

  • by

Install MySQL using configuration file

sudo su
sudo apt-get install gedit
cd /opt
tar xf /home/oem/Downloads/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz
mkdir /usr/local/mysql
chmod 764 /usr/local/mysql

ln -s /opt/mysql-5.7.29-linux-glibc2.12-x86_64/* /usr/local/mysql

 

Setting up the Path variable:

gedit ~/.bashrc
export PATH=$PATH:/usr/local/mysql/bin
source ~/.bashrc

 

Add user, make directory and setting up permissions:

adduser -system mysql
mkdir /var/lib/mysql
chown mysql /var/lib/mysql
mkdir /var/run/mysqld
chmod 777 /var/run/mysqld
chmod 777 /var/log
ls -l /var/log
gedit /etc/my.cnf

 

Mysql initialize using my.cnf

mysqld –initialize

(If getting libaio library file error at the time of mysql initialization run below command and initialization again)
sudo apt-get install libaio1 libaio-dev

Mysqld –initialize
cat /var/log/mysqld.log
mysqld &
mysqladmin -S/tmp/mysql.sock -p password

Setting up my.cnf with different parameters

Copy below configuration in my.cnf file and place it inside /etc directory

[mysqld]

datadir=/var/lib/mysql
port=33206
socket=/tmp/mysql.sock
user=mysql
log-bin=mysql1-bin
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Leave a Reply

Your email address will not be published.