Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu method steps for installing MySQL5.7 and configuring data storage path

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

First, install MySQL

This article is installed through APT, and the latest version is 5.7.21

(note: the version installed through APT is the latest version now. After installation in this way, boot and self-startup have been configured, and the environment variables on the command line do not need to be manually configured. )

Sudo apt-get install mysql-server

If the prompt is insufficient, run the following command to solve the dependency problem, if there is no dependency problem, then you do not need to use this command

Sudo apt-get install-f

The installation process prompts for the root user password twice

Description: after being installed in this way, the boot self-startup has been configured, and the environment variables on the command line do not need to be manually configured.

After installation, the following directory will be created:

Database directory: / var/lib/mysql/

Configuration file: / usr/share/mysql (command and configuration file), / etc/mysql (e.g. my.cnf)

Related commands: / usr/bin (mysqladmin mysqldump, etc.) and / usr/sbin

Startup script: / etc/init.d/mysql (directory of startup script file mysql)

Service management

Start sudo service mysql start

Stop sudo service mysql stop

Service status sudo service mysql status

2. Configure the MySQL data storage path

I use Aliyun. Aliyun gives away a 20-gigabyte data disk, and the mounted path is / data.

Create a folder

Mkdir / data/mysql

Copy the default installed MySql database to / data/mysql and set permissions

Sudo cp-R / var/lib/mysql/* / data/mysqlsudo chown-R mysql:mysql / data/mysql

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report