Step to Install MySQL on RedHat machine.
1. Create directory for MySQL base directory and data directory. This step will easier in future, for add another MySQL version or new Daemon without delete the existing version.
At here, /usr/share/mysql51 will be the base directory, while /var/lib/mysql51 will be data directory.
2. Create a new group and user called mysql, which will used only for restart the mysql engines.
3. Download the MySQL source using wget command.
"wget [MySQL-tar-URL
4. Once finished download, tar the file.
"tar zxf
5. Enter the directory then configure the package. Point the prefix to base diretory location.
"./configure --prefix=/usr/share/mysql51 --with-mysqld-user=mysql"
For MySQL version 5.1 above, some engines does not installed automatic and need to specified in the beginning when do compilation. For example, If need to add engines innobase, partition and federated, run the configure with.
"./configure --prefix=/usr/share/mysql51 --with-mysqld-user=mysql --with
Once compile success, will see the message as below.
Message when make and make install success.
7. Copy the my-medium.cnf file to /etc directory. Choose the my.cnf file according to the server specification.
"cp ./support-files/[my-type.cnf
8. Edit the my.cnf file
Add new variable datadir which point to the data directory created.
Change and add any necessary variables.
"/usr/share/mysql51/bin/mysql_install_db --user=mysql"
Message show once the install db success. Check any error appear which indicate the wrong setting appear in the my.cnf.
10. Change the ownership on the basedir and datadir.
"chown -R root:mysql
"chown -R mysql:mysql
"/usr/share/mysql51/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &"
12. Access to MySQL with command and set password for MySQL root user.
"/usr/share/mysql51/bin/mysql -u[
"SET PASSWORD FOR root@localhost=PASSWORD('
新型冠狀病毒 (COVID-19)
4 years ago
Comments :
Post a Comment