Installing MySQL On Unix Linux Using Generic Binaries
Installing MySQL On Unix Linux Using Generic Binaries
html
General steps:
As root user:
# groupadd mysql
https://dev.mysql.com/downloads/mysql/
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
ln -s /usr/local/mysql-5.7.21-linux-glibc2.12-x86_64 mysql
cd mysql
Create a location to put the mysql-files (data files, Log files, backups etc)
mkdir –p /usr/local/data
mkdir –p /usr/local/logs
mkdir –p /usr/local/backups
Make sure mysql user and mysql group owns the folders and files in them
https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html
Make sure that the database directories and files are owned by the mysql login account so that the server
has read and write access to them when you run it later. To ensure this, start mysqld from the system
root account and include the --user
NB: It might be necessary to specify other options such as --basedir or --datadir if mysqld cannot
identify the correct locations for the installation directory or data directory.
Alternatively, put the relevant option settings in an option file and pass the name of that file to mysqld
In /etc/my.cnf
[mysqld]
basedir=/usr/local/mysql
datadir=/usr/local/data
Then invoke mysqld on a single line with the --defaults-file option first:
Start MySQL
The mysqld_safe will start mysqld server as the mysql user and the & will send the mysqld_safe
command to the background.
Check the error log for verification of a successful startup and then log in.
cp support-files/mysql.server /etc/init.d/mysql.server
Its best to call the script by the name you will use to call it with either
the service command or systemctl command.
cp support-files/mysql.server /etc/init.d/mysqld
cp support-files/mysql.server /etc/rc.d./init.d/mysqld
Make sure MySQL server starts when the Linux server reboots:
the mysqld will be the name of the script needed to run or start MySQL
server. It the name was mysql instead of mysqld:
cp support-files/mysql.server /etc/init.d/mysql
or
Make sure you can get to all the MySQL programs or executable binaries from
anywhere on the system you are logged into by adding the bin folder path to
the Linux OS system path.
ln -s /usr/local/mysql-5.7.21-linux-glibc2.12-x86_64 mysql
export PATH=$PATH:/usr/local/mysql/bin
To make this permanent to the system to survive a linux reboot add the export
to the system profile and your bash_profile file.
$ echo $PATH
The changes will not take effect until you log out of the terminal and re-log
back in.
Force the system to re-read the profile files while logged in:
source ~/.bash_profile