MySQL Administration – day 2

Install MySQL using config 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

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

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

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

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

[mysqld]

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

Author: Sauras Pandey

Sauras Pandey is an MCP, SQL Server DBA/Architect with 9+ years of experience working in a variety of environments

Leave a Reply

Your email address will not be published.