Steps for installing MySQL using Tar in Linux

Source: Internet
Author: User
1. installation environment operating system: redhatlinuxenterprenterpriseas4.0 Database: MySQL6.0.6Web server: Apache2.2.9 script language: PHP5.2.62. install My

1. installation environment operating system: Red Hat Linux Enterprise AS 4.0 database: MySQL 6.0.6Web server: Apache 2.2.9 script language: PHP 5.2.62. install My

1. installation environment
Operating System: Red Hat Linux Enterprise AS 4.0
Database: MySQL 6.0.6
Web server: Apache 2.2.9
Script Language: PHP 5.2.6

2. Install MySQL 6.0.6

# Groupadd mysql
# Useradd-g mysql
# Tar xzvf mysql-6.0.6-alpha.tar.gz
# Cd mysql-6.0.6-alpha
#./Configure -- prefix =/usr/local/mysql
# Make
# Make install
# Cp support-files/my-medium.cnf/etc/my. cnf
# Cd/usr/local/mysql
# Chown-R mysql.
# Chgrp-R mysql.
# Bin/mysql_install_db -- user = mysql
# Chown-R root.
# Chown-R mysql var
# Bin/mysqld_safe -- user = mysql &

The details are as follows:

1) create directories and groups:
# Mkdir/usr/local/mysql
# Groupadd mysql
# Useradd-g mysql // useradd-g mysql-d/usr/local/mysql name

2) Start mysql Installation
# Tar xzvf mysql-6.0.6-alpha.tar.gz // Extract

# Cd mysql-6.0.6-alpha // enter the decompressed file directory

#./Configure -- prefix =/usr/local/mysql \ // set the installation directory
-- Enable-thread-safe-client \ // compile the client library of thread security Edition
-- Without-debug \ // disable the debug function
-- With-extra-charsets = gb2312 \ // added support for gb2312 Chinese Characters
-- Enable-javaser \ // use the assembly version of some character Functions
-- With-raid \ // activate raid support

# Make // compile

# Make install // install

3) copy the configuration file
There are three environments: large, medium, and small. Depending on the machine performance, if the load is large, you can modify the memory usage values of some variables.
# Cp support-files/my-medium.cnf/etc/my. cnf // copy the configuration file

4) Change directory permissions and Groups
# Cd/usr/local/mysql
# Chown-R mysql.
# Chgrp-R mysql.

5) create databases and tables
# Bin/mysql_install_db -- user = mysql // initialize authorization

Note: If the following error is reported:
Installing MySQL system tables...
[ERROR]/usr/local/mysql/libexec/mysqld: unknown option '-- skip-federated'
[ERROR] Aborting
[Note]/usr/local/mysql/libexec/mysqld: Shutdown complete
Just comment out skip-federated from the/etc/my. cnf file.

6) Change directory permissions and groups again
# Chown-R root.
# Chown-R mysql var

7) Start the MySQL Service
# Bin/mysqld_safe -- user = mysql &
// Start MySQL (The & character tells the operating system to run MySQL in the background;
// It is ignored by MySQL itself.
// If an error is reported, check the log files in/usr/local/mysql/var)

8) set MySQL to start the service.
# Cp/usr/local/mysql/share/mysql. server/etc/init. d/mysqld
# Chkconfig -- add mysqld // add mysqld to the Auto Start List
# Chkconfig -- level 345 mysqld on

9) change the MySQL password
#/Usr/local/mysql/bin/mysqladmin-u root password 'new-password' // change the password
#/Usr/local/mysql/bin/mysqladmin-u root-h localhost password 'new-password'
// Replace localhost with your host domain name, for example, zhaorg.csu.edu.cn.

10) log on to the mysql database:

# Mysql-u root-p
Enter password: root
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 18 to server version: 5.0.19-log
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql> use mysql;
Mysql> delete from user where password = ""; // delete an empty password account used for anonymous local connection
Mysql> flush privileges;
Mysql> quit

(Alternatively, run the following command (Alternatively you can run ):
#/Usr/local/mysql/bin/mysql_secure_installation
// Which will also give you the option of removing the test
// Databases and anonymous user created by default. This is
// Stronugly recommended for production servers .)

11) Close the MySQL Service

#/Usr/local/mysql/bin/mysqladmin-u root-p new-password shutdown // close MySQL

3. install Apache 2.2.9

# Tar zvxf httpd-2.2.9.tar.gz

# Cd httpd-2.2.9

#./Configure -- enable-modules = all -- enable-so // DSO capability

# Make

# Make install

Start Apache service
#/Usr/local/apache2/bin/apachectl start

Disable the Apache service
#/Usr/local/apache2/bin/apachectl stop

Restart the Apache service
#/Usr/local/apache2/bin/apachectl restart

Set Apache startup Service
# Cp/usr/local/apache2/bin/apachectl/etc/init. d/httpd

Change the configuration file
# Vi/usr/local/apache2/conf/httpd. conf

DocumentRoot "/usr/local/apache2/htdocs" // root directory of the document that provides Web Services

// This shoshould be changed to whatever you set DocumentRoot.

4. install PHP 5.2.6

# Tar xzvf php-5.2.6.tar.gz

# Cd php-5.2.6

#./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql /\
-- With-oci8 = share, instantclient,/usr/lib/Oracle/10.2.0.3/client/lib // provides support for Oracle databases

(Note: If MySQL uses the default installation path -- prefix =/usr/local/mysql is not specified, use the following command:
#./Configure -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql
Otherwise, an error similar to the following will be reported:
Configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore !)

# Make

# Make install

Copy configuration file
# Cp php. ini-dist/usr/local/lib/php. ini

Configure the httpd. conf file of the Apache service
* Add LoadModule php5_module module/libphp5.so to LoadModule.
* Add index. php at DirectoryIndex
* Add in AddType application
AddType application/x-httpd-php. php. phtml
AddType applicatoin/x-httpd-php-source. phps

Reprinted please indicate the source! Thank you!

Linux community (Linuxidc) statement: the Linux community published this article for the purpose of transmitting more information, does not mean to agree with its views or confirm its description.

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.