1. You need the mysql installation package and unzip it. Use the unzip command tar -zxvf + compressed package name
2. Copy it to the location where it needs to be installed
I plan to install it in the /usr/local/mysql directory
3. Create a mysql user and mysql group for managing mysql
1. Configure installation and other information
./configure --prefix=/usr/local/mysql/ --with-charset=utf8 --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --with-named-curses-libs=/lib/libncursesw.so.5
View the installation configuration parameter method./configure –help
Configuration of common parameters:
Parameter | Description |
---|---|
–prefix= /usr/local/mysql/ | Installation path |
–with-charset=utf8 | mysql default character set |
with-extra-charsets=all | Support multiple languages |
–with-unix-socket-path=/usr/local/mysql/var /mysql.sock | This specifies the location and file name of the online socket file after the mysql server is started. In other words, if the CentOS mysql server is successfully started, it can be found in //usr/ See the mysql.sock file in the local/mysql/mysql/var directory. If you can’t see it, it must be that CentOS mysql cannot be started. |
–with-named-curses-libs=/lib/libncursesw.so.5 | In order to allow mysql to Identify the path |
The character set allowed by mysql is
The configuration completion interface is as follows
2. Execute make Command
If the following error is prompted at this time
No curses/termcap library found
Solution:
Solution (CentOS)
yum list|grep ncurses
yum -y install ncurses-devel
The final interface is as follows
3. Execute the make install command
4. Create mysql authorization table
After doing these tasks, you must create the CentOS mysql authorization table, otherwise the database will not start. The commands for mysql installation are all installed in the directory /usr/local/mysql/bin.
After running the mysql_install_db command, if we check /usr/local/mysql, we will find that there is a var directory. This directory is where all databases are installed. For example, after we create the xxpt database, there will be a xxpt directory in the /usr/local/mysql/var directory.
Start mysql
mysql.server start
Close mysql
mysql.server stop
The mysql.server file is located in the /usr/local/mysql/share/mysql directory.
The above is the detailed explanation of MySQL5.1 installation under Linux. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!