Get the App
SLTechnology News&Howtos  ›  Database  › 

Installation steps of MySQL5.1 under Linux

Shulou Source: shulou.com Published: 2022-05-31 18:47:31 09月16日 Update

This article mainly explains the "installation steps of MySQL5.1 under Linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the installation steps of MySQL5.1 under Linux.

Installation steps of MySQL5.1 (|) in Linux environment

1. MySQL installation-free version / binary plate software (no compilation)

File format: MYSQL-VERSION-OS.tar.gz

2. Create a MySQL group, establish MySQL users and join the group

(the syntax of groupadd and useradd may be slightly different in different versions of Unix. )

# groupadd mysql

# useradd-g mysql mysql

3. Enter the directory / usr/local, extract the free installation version, and set up a soft link named mysql in this directory.

# cd / usr/local

# gunzip

< /path/to/MYSQL-VERSION-OS.tar.gz | tar xvf - (该命令会在本目录下创建一个名为MYSQL-VERSION-OS的新目录。) (使用GNU tar,则不再需要gunzip。你可以直接用下面的命令来解包和提取分发: #>

Tar zxvf / path/to/mysql-VERSION-OS.tar.gz)

# ln-s MYSQL-VERSION-OS mysql

4. Add MySQL configuration file

If you want to set an options file, use one of the support-files directories as a template. There are four template files in this directory, which are customized according to the memory of different machines.

# cp support-files/my-medium.cnf / etc/my.cnf

(maybe you need to run these commands with the root user.)

5. Set directory access permissions, create MySQL authorization table initialization with mysql_install_db, and set mysql,root account access permissions

# cd mysql

# chown-R mysql.

# chgrp-R mysql.

# scripts/mysql_install_db-user=mysql

# chown-R root.

# chown-R mysql data

(pay attention to the "." symbols in the above command.)

6. Run MySQL

# bin/mysqld_safe-user=mysql &

(if there is no problem, there should be a prompt like this:

[1] 42264

# Starting mysqld daemon with databases from / usr/local/mysql/var

If there is a statement like mysql ended, which means that Mysql is not starting properly, you can find the problem in log. The Log file is usually configured in / etc/my.cnf.

Most of the problems are caused by incorrect permission settings. )

7. Set the root password. The default installation password is empty. You need to change the password for security.

# / usr/local/mysql/bin/mysqladmin-uroot password yourpassword

8. Copy a script in the compilation directory and set it to boot automatically.

# cp support-files/mysql.server / etc/rc.d/init.d/mysqld

# chmod 700 / etc/init.d/mysqld

# chkconfig-add mysqld

# chkconfig-level 345 mysqld on

9. Start the mysqld service

# service mysqld start

10. Check whether port 3306 is open. Pay attention to opening the port in the firewall

# netstat-atln

Overview of basic commands for installation-free / binary plate installation:

Shell > groupadd mysql

Shell > useradd-g mysql mysql

Shell > cd / usr/local

Shell > gunzip

< /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf - shell>

Ln-s FULL-PATH-TO-MYSQL-VERSION-OS mysql

Shell > cd mysql

Shell > chown-R mysql.

Shell > chgrp-R mysql.

Shell > scripts/mysql_install_db-user=mysql

Shell > chown-R root.

Shell > chown-R mysql data

Shell > bin/mysqld_safe-user=mysql &

Thank you for reading, the above is the content of "installation steps of MySQL5.1 under Linux". After the study of this article, I believe you have a deeper understanding of the installation steps of MySQL5.1 under Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Directories steps commands files questions differences passwords permissions learning binary content templates users ports compilation running configuration security no memory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia MySQL Huawei Shulou Information Shulou Tech Info