Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL5.5 source code installation

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. useradd -M -s /sbin/nologin mysql//Create a new program user and join mysql group, login system is not allowed 2. Unpack cd //Switch to the current user's home directory tar -zxvf mysql-5.5.22.tar.gz -C /usr/src/ //extract package cd /usr/src/mysql-5.5.22/ //Enter the extract directory 3. Configure the installation options yum -y install cmake ncurses-devel//install build dependency packages (MySQL-5.x later use cmake to compile and install) cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc

option

-DCMAKE_INSTALL_PREFIX: Specify MySQL installation location

-DDEFAULT_CHARSET: Specifies the default character set encoding

-DDEFAULT_COLLATION: Specifies that character set collation rules are used by default

- DWH-EXTRA-CHARSETS: Specify additional supported character set encodings

-DSYSCONFDIR: Configuration file storage location

4. Compile and install make && make install5. Configure MySQLchown -R mysql:mysql /usr/local/mysql/ //Database directory ownersAll group settingscp/usr/src/mysql-5.5.22/support-files/my-medium.cnf /etc/my.cnf//copy source directory Provide configuration files/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data///execute initialization scripts to generate default libraries and tables

option

--user: Specify the running user

--basedir: Specify MySQL database location

--datadir: Specify MySQL data storage location

echo "PATH=$PATH:/usr/local/mysql/bin">>/etc/profile //Add MySQL to the search path to facilitate the execution of the command source /etc/profile //Make the profile file content effective immediately 6. Start the service cp /usr/src/mysql-5.5.22/support-files/mysql.server /etc/init.d/mysqld/Copy the service script file to/etc/init.d/directory and rename it mysqldchmod +x /etc/init.d/mysqld //give script execution permissions chkconfig --level 35 --add mysqld //Add to system service, 35 level boot boot/etc/init.d/mysqld start or service mysqld start //start service netstat -utpln| grep mysqld //Filter the port mysql listens on to see if the service is enabled 7. Change the password

mysqladmin -u root password "123" //Set MySQL, root password is 123, default is empty

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report