Install mysql-5.0.45.tar.gz

Source: Internet
Author: User

 

(AH) recently, due to work needs, I finally started to play with Linux. Today I have compiled and installed MySQL for a day and recorded it. Forget it !!

 

(Card) installation environment: vmware5 (Bridge Mode) + RedHat e as 4 + have installed development tools and related development kits (customized when installing the Linux system), and the test is successful

 

(!) The MySQL for Linux source code is in xx.tar. ZG format.

Http://www.filewatcher.com/m/mysql-5.0.45.tar.gz.24433261.0.0.html

 

(1)

------------- Preparations ----------

1: If the downloaded file name: mysql-5.0.45.tar.gz

2: If copy to/home

3: groupadd MySQL # Add a MySQL Group

4: useradd-G MySQL # Add a MySQL user

5: CD/home # enter the Directory

 

----------------------- Compilation process -----------------------

6: Tar zxvf mysql-5.0.45.tar.gz # After decompression, a folder with the same name will appear in this directory

7: CD/home/mysql-5.0.45

8 :. /configure -- prefix =/usr/local/MySQL -- With-charset = utf8 -- With-collation = utf8_general_ci -- With-extra-charsets = Latin1 # parameter settings, you can not understand first, modify the configuration later

9: Make

10: make install

11: CP support-files/my-medium.cnf/etc/My. CNF # If/etc/My. CNF already exists, back up and delete

12: VI/etc/My. CNF # comment out log-bin = mysql-bin

 

-------------------------- Install and configure MySQL --------------------------

13: CD/usr/local/MySQL

14: Bin/mysql_install_db -- user = MySQL # initialize MySQL

15: chown-r root. # change the folder in the current directory to root. Note: There is a. Ah, indicating the current directory.

16: chown-r MySQL/usr/local/MySQL/var #-r indicates all directories under Recursion

17: chgrp-r MySQL/usr/local/MySQL # change the directory to MySQL

18: Bin/mysqld_safe -- user = MySQL & # Start MySQL

 

--------------------------------------- Change the root user password of MySQL ----------------------------

19: Bin/mysqladmin-uroot password 123456 # change the logon password of the root user when the MySQL political party starts.

20: Bin/MySQL-uroot-P # after entering this command, you will be prompted to enter the root user password 123456,

21: Show databases; # If you find all the databases, congratulations.

 

---------------------------------------------------- Add MySQL to the System Service -------------------------------------

22: CP/usr/local/MySQL/share/MySQL. Server/etc/init. d/mysqld

Chkconfig -- add mysqld # To the system service, you can manage it through service mysqld START | stop | status | restart, which is very convenient, you no longer need to start MySQL at/usr/local/mysql5.0.45/bin /.

 

---------------------------------------------------------------- Configure the MySQL environment variable ------------------------------------------------

23: CD/root # Go back to your personal home directory. I used root to log on here.

CP. bashrc. bashrc. Bak # back up

Vi. bashrc

Add: Export Path =/usr/local/MySQL/bin: $ path :.
Source ~ /. Bashrc # Return to the terminal and enter this command to make the modification take effect ,~ Represents the user's main directory

Env # Check whether it takes effect

24: This is a method to replace steps 23.

CP/usr/local/MySQL/bin/MySQL/usr/bin/MySQL # Add the commonly used MySQL tool directories to the system variable directories, and add them as needed, in this way, you can directly run the tool without switching to the directory, which is similar to adding environment variables.

 

------------------------------------------------------------------------------- Open port 3306 in Linux -------------------------------------------

25: Service iptables stop

VI/etc/sysconfig/iptables

-A RH-Firewall-1-INPUT-M state -- state new-m tcp-p tcp -- dport 3306-J accept

Service iptables start

 

----------------------------------------------------------------------------- Enable the MySQL remote access permission for the root user --------------------------------------------

26: shutdown-HR now # restart

PS-E | grep MySQL # Check whether MySQL is started with startup, or enter: Service mysqld status

Mysql-uroot-P # Enter MySQL

Enter the root user password

Grant all on *. * to root @ '%' identified by '20140901 ';

# Grant permission on database name. Table name to user @ login host identified by "User Password ";

Flush privileges; # For Development convenience, the root user can have remote access permissions.

# Finally, attach a very useful MYSQL client, http://download.csdn.net/source/924456

 

(2) The default MySQL database directory is/usr/local/mysql-5.0.45/var

We specified the installation directory as/usr/local/mysql-5.0.45 during installation, in addition to installing the desired file here, there are some users commonly used, the executable binary file is put in/usr/bin, in fact, in/usr/local/mysql-5.0.45/bin, all of these commands, the command in/usr/bin is used for convenience. It is equivalent to setting the environment variable. You can echo $ path, it must have the value of/usr/bin.

Understanding the installation process makes it hard to delete MySQL.

 

(3) through a complete example, I will learn a lot. Common Linux commands really need to be prepared by myself.

Fighting and keep moving !!

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.