# install mysql 5.7.44 on ubuntu 22.04 from source tar.gz file
- Remove existing MySQL
- sudo apt remove --purge mysql* -y
- sudo apt autoremove -y
- sudo rm -rf /etc/mysql /var/lib/mysql
- extract mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz file [ tar -xvzf mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz ]
- install this file [ libaio1_0.3.113-4_amd64.deb, libncurses5_6.2-0ubuntu2_amd64.deb, libtinfo5_6.2-0ubuntu2_amd64.deb ]
- libaio1_0.3.113-4_amd64.deb
- sudo dpkg -i libaio1_0.3.113-4_amd64.deb
- verify
- ls -l /usr/lib/x86_64-linux-gnu/libaio.so.1, show message : [ lrwxrwxrwx 1 root root 15 Jan 18 2023 /usr/lib/x86_64-linux-gnu/libaio.so.1 -> libaio.so.1.0.2 ]
- libncurses5_6.2-0ubuntu2_amd64.deb
- sudo dpkg -i libncurses5_6.2-0ubuntu2_amd64.debc
- verify
- ls -l /usr/lib/x86_64-linux-gnu/libncurses.so.5, show message : [ lrwxrwxrwx 1 root root 17 Feb 26 2020 /usr/lib/x86_64-linux-gnu/libncurses.so.5 -> libncurses.so.5.9 ]
- libtinfo5_6.2-0ubuntu2_amd64.deb
- sudo dpkg -i libtinfo5_6.2-0ubuntu2_amd64.deb
- verify
- ls -l /lib/x86_64-linux-gnu/libtinfo.so.5, show message : [ lrwxrwxrwx 1 root root 15 Feb 26 2020 /lib/x86_64-linux-gnu/libtinfo.so.5 -> libtinfo.so.5.9 ]
- mv mysql-5.7.44-linux-glibc2.12-x86_64 /usr/local/mysql
- sudo groupadd mysql
- sudo useradd -r -g mysql -s /bin/false mysql
- sudo mkdir mysql-files
- sudo chown mysql:mysql mysql-files
- sudo chmod 750 mysql-files
- cd mysql
- cp support-files/mysql.server /etc/init.d/mysql
- sudo mkdir /usr/local/mysql/data
- sudo chown -R mysql:mysql /usr/local/mysql
- sudo chown -R mysql:mysql data
- chmod +x /etc/init.d/mysql
- Initialize MySQL Data Directory (if not done)
- cd /usr/local/mysql
- sudo rm -rf data
- sudo mkdir data
- sudo chown -R mysql:mysql data
- sudo ./bin/mysqld --initialize --user=mysql --basedir=$(pwd) --datadir=$(pwd)/data
- start mysql
- sudo /usr/local/mysql/bin/mysqld_safe --user=mysql --datadir=/usr/local/mysql/data &
- /usr/local/mysql/bin/mysql -u root -p --socket=/usr/local/mysql/mysql.sock
- reset root password
- ALTER USER 'root'@'localhost' IDENTIFIED BY 'sap123ok';
- create user password sap
- CREATE USER 'sap'@'%' IDENTIFIED BY 'sap123ok';
- GRANT ALL PRIVILEGES ON . TO 'sap'@'%' WITH GRANT OPTION;
- FLUSH PRIVILEGES;
- sudo ufw allow 3306/tcp [ if firewall on ]
- check user + SELECT User, Host FROM mysql.user;
- start mysql manual ./bin/mysqld_safe --defaults-file=./etc/my.cnf --user=mysql &
- Start MySQL in safe mode (no password required) + ./bin/mysqld_safe --skip-grant-tables --skip-networking &
- error check mysql + cd /usr/local/mysql/data + ls -l *.err
- mysql status check + ps aux | grep mysqld