Home > Database > Mysql Tutorial > How to install mysql under linux

How to install mysql under linux

(*-*)浩
Release: 2020-09-15 16:01:06
Original
26722 people have browsed it

How to install mysql under Linux: First go to the mysql official website to download the compressed package; then decompress the compressed package and enter the mysql directory; finally execute the [./scripts/mysql_install_db --user=mysql] command.

How to install mysql under linux

First go to the mysql official website to download the mysql compiled binary installation package, select linux-generic in the Select Platform: option on the download page, and then scroll to the bottom of the page. Download Linux - Generic (glibc 2.5) (x86, 64-bit) for 64-bit systems, and download Linux - Generic (glibc 2.5) (x86, 32-bit) for 32-bit systems

Unzip the 32-bit installation package:

Enter the directory where the installation package is located and execute the command: tar mysql-5.6.17-linux-glibc2.5 -i686.tar.gz

Copy the decompressed mysql directory to the system’s local software directory:

Execute command: cp mysql-5.6.17-linux-glibc2.5-i686 /usr/local/mysql -r

Note: Do not add /

# at the end of the directory ## Add system mysql group and mysql user:

Execute command: groupadd mysql and useradd -r -g mysql mysql

## Install database:

Enter the directory where mysql software is installed: execute the command cd /usr/local/mysql

to modify the current The directory owner is the mysql user: execute the command chown -R mysql:mysql ./

Install the database: execute the command ./scripts/mysql_install_db --user=mysql

Modify the current directory owner to Root user: Execute the command chown -R root:root ./

Modify the current data directory owner to the mysql user: Execute the command chown -R mysql:mysql data

The database installation is completed

How to install mysql under linux

Start mysql service and add startup mysql service:


Add startup: execute command cp support-files/ mysql.server /etc/init.d/mysql, put the startup script in the boot initialization directory

Start the mysql service: execute the command service mysql start

Execute the command: ps -ef|grep mysql See the mysql service description for successful startup, as shown in the figure

#Modify the root user password of mysql, the initial root password is empty:

Execute command: ./bin/mysqladmin -u root password 'password'

Put the mysql client to the default path:

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

Note: It is recommended to use a soft link instead of directly copying the package file to facilitate the system installation of multiple versions. mysql

More detailed content address above: http://jingyan.baidu.com/article/a378c9609eb652b3282830fd.html

Note:

I feel that the series of MySQL 5.7 versions are very abnormal. Whether it is Windows or Linux, there will always be some inexplicable ideas during installation. When I first installed MySQL under Windows, I was young and ignorant and installed version 5.7. As a result, various elusive bugs appeared. I couldn't find them even if I searched online. Finally, I found a person who had the same problem and complained that it was a version problem and pretended to be 5.6. Enough. This time I installed Linux. Being young and frivolous, I forgot the lessons I learned under Windows and installed 5.7. As a result, various bugs kept appearing. Alas, I was still too young. I hope everyone can learn a lesson.

9. Use after installation

After installation, you can enter mysql -uroot -p, and then enter password to enter mysql.

After entering, you can use various syntaxes of mysql. First, you can view the database: show databases.

The above is the detailed content of How to install mysql under linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template