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

How to install MYSQL in Debian

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is to share with you about how to install MYSQL in Debian, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Debian install MYSQL

# chmod 755 mysql-5.5.25.tar.gz

# tar xfz mysql-5.5.25.tar.gz

After decompression, the 5.5.25 directory is generated, and we enter this directory:

Cd mysql-5.5.25

After entering, we start to configure mysql. During the configuration process, we need to set an installation directory for mysql. We set it under / usr/local/mysql and think it is easier to manage the files in one place. If you want to get more configuration information, use. / configure-- help:

Compiled like this

#. / configure-prefix=/usr/local/mysql

Then wait a few seconds and compile the source code after the configuration is complete.

# make www.2cto.com

This compilation process is relatively long, if the machine is slow, it may take nearly 20 minutes (my Lenovo server takes 15 minutes). Install after compilation:

# make install

Wait a few seconds and the installation is complete. Next to the most critical part, why the old installation is not successful, (at least I installed the Numberbatch journal N > 10, hehe), the crux of the problem is here, access to mysql needs a special user, and must be given the corresponding access rights, here we set root and mysql to have access.

Let's first set up a mysql and mysql user to access mysql:

# groupadd mysql # create a mysql group

# useradd mysql-g mysql # establish a mysql user and join the mysql group

After the user is established, we initialize the table (Note: this step must be performed before the following steps can be performed)

#. / scripts/mysql_install_db-- user=mysql # initially test the table and specify that the initialization table will be accessed by mysql users. After setting access permissions for mysql and root users, let's first go to the directory where mysql is installed:

# cd / usr/local/mysql

Then set permissions the directory here may be different from the mysql

# chown-R root. # set root to access / usr/local/mysql

# chown-R mysql var # set mysql users to access / usr/local/mysql/var, which contains mysql files

# chown-R var/. # set mysql users to access all files under / usr/local/mysql/var

# chown-R mysql var/mysql/. # set mysql users to access all files under / usr/local/mysql/var/mysql www.2cto.com

# chgrp-R mysql. # set mysql group to access / usr/local/mysql

After the setup is complete, it is basically installed. OK, let's run our mysql:

# / usr/local/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

Join bash

Ln-s / usr/local/mysql/bin/mysql / usr/bin/mysql

Mysql-uroot access

This proves that you have successfully installed it.

Use the following command to change the MYSQL password. The default installation password is empty. For security, you must modify it immediately.

/ usr/local/mysql/bin/mysqladmin-uroot password pengyong

The password changed now is: pengyong

The above is how to install MYSQL in Debian. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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: 268

*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

Database

Wechat

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

12
Report