Install mysql in Linux

Source: Internet
Author: User

Install mysql
// Upload mysql-5.0.221.tar.gz to this path:/mnt/disk1/program and install
Tar-xzvf mysql-5.0.221.tar.gz
Cd mysql-5.0.22
# Creating a folder
Mkdir/mnt/disk1/program/mysql
# Create a group/etc vi group
Groupadd mysql
# Create a user/home under a group
Useradd-g mysql
# Configuration path
./Configure -- prefix =/mnt/disk1/program/mysql -- with-pic -- with-fPIC can be omitted
# Install the project file
Make clean
# Compile the project
Make
# Install the project file to the System
Make install

#/Mnt/disk1/program/mysql-5.0.22/scripts/mysql_install_db
######################################## ########################
# Initialize the authorization list, which includes the following permission sets
# The MySQL root User is created as a super user who can do anything. The connection must be sent by the local host.
# The generated root password is empty, so anyone can connect with root without a password and grant all permissions.
######################################## ########################
./Scripts/mysql_install_db

 

# Change the owner and group of all files in/mnt/disk1/program/mysql/to User root
Chown-R root/mnt/disk1/program/mysql/

# Change the owner and group of all files in/mnt/disk1/program/mysql/var/to mysql
Chown-R mysql/mnt/disk1/program/mysql/var/

# Changing the user group of a file
Chgrp-R mysql/mnt/disk1/program/mysql/

# At This Point, mysql installation is complete and can be started
/Mnt/disk1/program/mysql/bin/mysql
# Exit quit
Quit

# Copy/mnt/disk1/program/mysql-5.0.22/support-files/my-huge.cnf to/etc/my. cnf
Cp support-files/my-huge.cnf/etc/my. cnf
Cp/mnt/disk1/program/mysql/share/mysql. server/etc/init. d/mysql

# Start a mysql database
/Mnt/disk1/program/mysql/bin/mysqld_safe -- user = mysql &
# Setting a password for mysql
/Mnt/disk1/program/mysql/bin/mysqladmin-u root password''
# Soft link/sbin/mysql
Ln-s/mnt/disk1/program/mysql/bin/mysql/sbin/mysql
# Soft link/sbin/mysqladmin
Ln-s/mnt/disk1/program/mysql/bin/mysqladmin/sbin/mysqladmin

# Start and Stop the service
Service mysql start
Service mysql stop
# Restart the service
Service mysql restart

Service mysqld status

Author "lvlin1983"
 

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.