Manual installation of MySQL in Ubuntu

Source: Internet
Author: User
This article describes how to install mysql without apt in Ubuntu and enable Automatic startup. 1. Install mysql1. Download and decompress the package. First, run to http://dev.mysql.com/downloads/mysql/5.0.html#downloadsand download a mysql. I downloaded Linux (x86) 59.5 M from nonRPMpackages.

This article describes how to install mysql without apt in Ubuntu and enable Automatic startup.

1. Install mysql

1. Download and decompress
Run http://dev.mysql.com/downloads/mysql/5.0.html#downloadsto download a mysql. I downloaded the Linux (x86) 59.5 M packages in Linux (non RPM packages). You should find the appropriate version to download based on your machine's situation. Generally, amd uses AMD64.

After the download, decompress the package and place all my development software under/develop. Therefore, decompress the package to/develop and rename the directory mysql. You can establish a directory based on your actual situation. Because it is a compiled version, you can directly test it now without any installation process.

2. Configure permissions and users
This step is troublesome. I refer to the official installation documentation.
First, you need to add a user group named mysql to mysql and, of course, a member named mysql. This step can be completed in any directory.

Sudo groupadd mysql
Sudo useradd-g mysql
Step 1 create a mysql group and add a user named mysql to it.

Then go to the mysql installation directory.
Cd/develop/mysql

Then grant the corresponding permissions to the user.
Sudo chown-R mysql.
Sudo chgrp-R mysql.

Then install the corresponding database and grant it the corresponding Permissions
Sudo scripts/mysql_install_db -- user = mysql
Sudo chown-R root.
Sudo chown-R mysql data

3. Start Mysql
If the preceding steps are correct, you can test and start Mysql. The current working directory is still under/develop/mysql
Sudo bin/mysqld_safe -- user = mysql &

Start the service according to the daemon process.

To log on as the root user of mysql, you can:
Bin/mysql-uroot-p

4. MySQL runs automatically upon startup

This place has made me a lot of effort. The first is to follow the official comments.
Use vim to open mysql under support-files. server, you will find that there are the following instructions: Put this file in/ect/init. d. Connect to/etc/rc3.d/S99mysql and/etc/rc0.d/K01mysql to start the instance. I tried it and it was not successful on my machine. Some configuration problems may occur. After that, I used sysv-rc-conf to solve the problem. However, this solution is not recommended.

Here is a good method, as shown below.

First, create a soft connection to the mysql. server File to the startup execution file and start the service
Sudo ln-s/develop/mysql/support-files/mysql. server/etc/init. d/mysql
Sudo ln-s/etc/init. d/mysql/etc/rc2.d/S18mysql

Even edit mysql. server
Sudo vim/develop/mysql/support-files/mysql. server

Find basedir = and enter/develop/mysql
The following datadir =, enter/develop/mysql/data
Save and exit.
I don't know whether this step is effective or not, but after it is changed, there is no problem running on me.

Make a script to quickly switch the mysql server. Run/usr/bin
Sudo vim my

Enter the following content
#! /Bin/sh
Exec/develop/mysql/support-files/mysql. server "$ @"
Save and exit. In this way, you can use sudo my start | stop | restart to control the mysql server. Then restart the machine.

Run/develop/mysql/bin/mysql to check whether the interface mode can be entered. Of course, don't forget to edit the/etc/profile file and put/develop/mysql/bin in PATH.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.