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

The method of installing Mysql under Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article mainly explains "how to install Mysql under Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to install Mysql under Linux".

It is really troublesome to install Mysql under Linux. After two days of installation, it is finally installed. Write down the installation steps so that you can avoid detours when installing later.

What I downloaded is the source package mysql-5.0.77-linux-i686-glibc23.tar.g.

One: installation steps

Storage path: / usr/local/

/ / extract the mysql source package

[root@localhost local] # tar zxvf mysql-5.0.77-linux-i686-glibc23.tar.gz

/ / modify the mysql-5.0.77-linux-i686-glibc23.tar.gz directory name mysql

[root@localhost local] # mv mysql-5.0.77-linux-i686-glibc23 mysql

/ / add user groups and users

[root@localhost local] # groupadd mysql

[root@localhost local] # useradd-g mysql mysql

/ / Update / etc/my.cnf

[root@localhost local] # cd mysql

[root@localhost mysql] # cp support-files/my-medium.cnf / etc/my.cnf

Cp: overwrite `/ etc/my.cnf'? Y

/ / initialize the database with mysql user, create Mysql authorization table, and must be mysql user

[root@localhost mysql] #. / scripts/mysql_install_db-user=mysql

/ / set directory permissions

[root@localhost mysql] # chown-R root.

[root@localhost mysql] # chown-R mysql data

[root@localhost mysql] # chgrp-R mysql.

/ / start mysql at the backend

[root@localhost mysql] # bin/mysqld_safe-- user=root &

If the word ". Ended" does not appear at this time, the installation is successful!

Execute the shell > mysql command on the command line, if the

Welcome to the MySQL monitor. Commands end with; or g.

Your MySQL connection id id 1

Server version:5.0.77-log MySQL Community Server (GPL)

Type 'help'or' h'for help. Type 'c'to clear the buffer.

Mysql >

Indicates that MySQL is installed successfully! If bash mysql:command not found appears, set the PATH environment variable, edit / etc/profile, add PATH=$PATH:/usr/local/mysql/bin at the end of the file, save the changes, and then execute the command

Shell > source / etc/profile, restart the system will be fine.

Two: boot self-start

However, after rebooting the system, you still need to use the bin/mysqld_safe-- usr=root command in the installation directory of mysql to start mysql manually. If you want to start mysql automatically after booting, you can use the following command:

Cp / usr/local/mysql/support-files/mysql.server / etc/init.d/mysql

Chkconfig-add mysql

Chkconfig-level 2345 mysql on

Chown mysql:mysql-R / usr/local/mysql

Service mysqld start

Chkconfig-- the meaning of 2345 in the command level 2345 msql on is not clear for the time being. When the system is rebooted, mysql will start automatically, which can be checked with the ps-aef | grep mysql command. You can also execute the mysql command directly under the command line. This will enter mysql > mode, and the installation is complete.

Three: set the password

The command to set the password is as follows:

Mysqladmin-u root passwordyour_password

At this point, I believe you have a deeper understanding of "the method of installing Mysql under Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Database

Wechat

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

12
Report