Solve MySQL programming on linux (1): Install MySQL and linuxmysql on the linux source code

Source: Internet
Author: User

Solve MySQL programming on linux (1): Install MySQL and linuxmysql on the linux source code
[Copyright statement: respect originality. For reprinted content, Please retain the Source: blog.csdn.net/shallnet. this document is only intended for study and exchange purposes. Do not use it for commercial purposes]
1. First download the source package:

ftp://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-5.1/mysql-5.1.72.tar.gz
2. Run the following command to check whether mysql is installed in the system:
rpm -qa |  grep mysql
3. If it is not installed, decompress the installation package and enter the directory:
cd mysql
Perform the following operations in sequence:
./configure --prefix=/usr/local/mysql --with-charset=gbkmakemake install

4. Add the MySQL configuration file

If you want to set an option file, use one of the support-files directories as the template. There are four template files in this directory, which are customized based on the memory of different machines.

#cp support-files/my-medium.cnf /etc/my.cnf

5. Set automatic start upon startup

#cp support-files/mysql.server /etc/rc.d/init.d/mysqld#chmod 755 /etc/init.d/mysqld#chkconfig –-add mysqld#chkconfig –-level 345 mysqld on

6. Create a mysql permission table:
cd /usr/local/mysqlscripts/mysql_install_db --user=mysql
7. Finally, change the owner and group of the installation directory to root and mysql respectively. The command is:
chown -R rootchgrp -R mysql
8. Is the test successful?
/etc/rc.d/init.d/mysqld start
9. Check whether port 3306 is Enabled:
# netstat -altnpActive Internet connections (servers and established)Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name  tcp        0      0 0.0.0.0:<strong>3306 </strong>               0.0.0.0:*                   LISTEN      6946/mysqld        tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1892/rpcbind        tcp        0      0 192.168.122.1:53            0.0.0.0:*                   LISTEN      2726/dnsmasq        
10. To ensure security, you need to change the password. The default value is null:
mysqladmin -u root password shallnet
Now, you can log on to mysql with a new password on the command line.

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.