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.