MySQL installation and configuration in Linux

Source: Internet
Author: User

1. Download, compile, and install
# Cd/usr/local/src/
# Wget http://mysql.byungsoo.net/Downloads/MySQL-5.1/mysql-5.1.38.tar.gz
# Tar-xzvf mysql-5.1.38.tar.gz ../software/
#./Configure
-- Prefix =/usr/local/mysql // MySQL installation directory
-- Datadir =/mydata // database storage directory
-- With-charset = utf8 // use UTF8 format
-- With-extra-charsets = complex // install all extended character sets
-- Enable-thread-safe-client // enable the secure thread of the client
-- With-big-tables // enable large tables
-- With-ssl // use SSL encryption
-- With-embedded-server // compile to embedded MySQL library (libmysqld. ),
-- Enable-local-infile // allow local data import
-- Enable-Cycler // compile common operators of x86 to improve performance
-- With-plugins = innobase // database plug-in
-- With-plugins = partition // table sharding function, which splits a large table into multiple small tables
# Make & make install // compile and install
2. Create users and groups
# Groupadd mysql // create a MySQL Group
# Useradd-g mysql-s/sbin/nologin mysql // create a MySQL user to belong to the MySQL Group
Iii. Configuration
# Chown-R mysql: mysql/usr/local/mysql/grant MySQL directory permissions to MySQL users and groups
# Cp/usr/local/src/software/mysql-5.1.38/support-files/my-medium.cnf/etc/my. cnf // configure file my. cnf
#/Usr/local/mysql/bin/mysql_install_db -- user = mysql // use MySQL to initialize the database
# Chown-R mysql: mysql/usr/local/mysql/var // give the initialized database directory to the MySQL owner
#/Usr/local/mysql/bin/mysqld_safe -- user = mysql & // start MySQL
4. Others
# Cp/usr/local/src/software/mysql-5.1.38/support-files/mysql. server/etc/init. d/mysqld
# Chmod 755/etc/init. d/mysqld
# Chkconfig -- add mysqld
# Chkconfig mysqld on
# Service mysqld restart
V. login Test
# Cd/usr/local/mysql/bin
# Mysql
> Show databases;
#
End of MySQL Installation

How to configure mysql in linux
In linux, the mysql configuration file path is under/usr/share/mysql.
Files are: my-huge.cnf, my-large.cnf, my-medium, my-small.cnf
Open one of these files as needed:
Find [mysqld] in the file
In the next line, add datadir = FILEPATH/* to the path where the database is stored */
Save the file
Input in shell
# Cp my-***. cnf/etc
# Cd/etc
# Mv my. cnf my. cnf. bak/* back up the previous mysql configuration file in the system */
# Mv my-***. cnf my. cnf
# Service mysqld start/* start mysql service */
# Ntsysv/* configure mysql to start automatically. In the pop-up window, select the mysqld service with a space and click "save */

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.