Linux installation MySQL5.6.24 usage instructions

Linux installation MySQL5.6.24 usage instructions

Linux installation MySQL notes

1. Before installing the MySQL database server, make sure your Linux system can connect to the network. We will install MySQL from source code. First, log in to your Linux system through putty and make sure that the gcc c++ and other compilation environments have been installed in the system, because MySQL has been compiled using cmake since version 5.5. If the three environments are not installed, you can use the following command to install them: yum -y install make gcc-c++ cmake bison-devel ncurses-devel

2. Check whether the relevant components of the MySQL database have been installed in the system. Use the command: rpm -qa | grep mysql to search. If found, you can use the following command to force uninstall: rpm -e --nodeps package name

If you used the default installation options when installing the Linux system, you can skip this step;

3. Then we download the mysql source installation package. Use the following command to download wget http://xiazai.jb51.net/201701/yuanma/mysql5.6.24(jb51.net).rar. The downloading time may be a bit long, please wait patiently;

4. After the download is complete, use the command: ll to view the existing mysql- 5.6.24.tar.gz file and then use the following command to decompress the compressed package: tar -zxvf mysql- 5.6.14.tar.gz

5. Then use the command: ll to view the current mysql-5.6.24 directory. Use the command: cd mysql-5.6.24 to switch to the mysql-5.6.24 directory;

6. After completing the above steps, let's start compiling the mysql file. First, configure the relevant compilation parameters and execute the following command:

Copy the code as follows:
cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/usr/local/mysql/data \-DSYSCONFDIR=/etc \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \-DMYSQL_TCP_PORT=3306 \-DENABLED_LOCAL_INFILE=1 \-DWITH_PARTITION_STORAGE_ENGINE=1 \-DEXTRA_CHARSETS=all \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci

Then use make && make install to compile and install mysql. You can also do it in two steps: run make first, then run make install after it is completed. The whole process takes about 30 minutes. Please be patient and wait. You can do something else during this time.

7. After the installation is complete, we also need to establish the mysql configuration. First, set the access rights of mysql. Use the command to check whether the mysql user and user group already exist. To view the user list command: cat /etc/passwd To view the user group list command: cat /etc/ group

8. If it does not exist, we need to create it: Add user group command: groupadd mysql Add user: useradd -g mysql mysql Then modify the user and user group accessing the directory where mysql is installed before Enter command: chown -R mysql:mysql /usr/local/mysql

9. Then initialize MySQL configuration and switch to the MySQL installation directory: cd /usr/local/mysql Execute the initialization configuration script and create the system database that comes with MySQL: ./scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql

10. Modify the MySQL configuration file. Enter the command: vi my.cnf and press the "insert" key on the keyboard. Then use the arrow keys on the keyboard to move the cursor to the line to be modified and add the following content: server-id=1 report-port=3306 port=3306 datadir=/usr/local/mysql/datasocket=/var/lib/mysql/mysql.sock

This step is very important. You need to change the owner of the configuration file: chown -R mysql:mysql /usr/local/mysql/my.cnf Otherwise, an error will be reported when starting the mysql service below;

11. Add MySQL to the startup items and start the MySQL service. (Note: When starting the MySQL service, my.cnf will be searched in a certain order. It will be searched in the /etc directory first. If it cannot be found, it will be searched in the directory where you installed MySQL. In this case, it is /usr/local/mysql/my.cnf. Note: After the minimum installation of the CentOS 6.4 operating system is completed, there may be a my.cnf in the /etc directory. You need to rename this file to another name, such as: /etc/my.cnf.bak. Otherwise, the file will interfere with the correct configuration of MySQL installed from source code and cause it to fail to start. The renaming command is: mv my.cnf my.cnf.bak) cp support-files/mysql.server /etc/init.d/mysqld #Copy the script chmod +x /etc/init.d/mysqld #Add executable permissions chkconfig --add mysqld #Add to sysV service chkconfig mysqld on #Startup service mysqld start #Start mysql service netstat -aux|grep mysq #View the started mysql process

12. Add MySQL environment variables to facilitate future operations. Enter the password: vi /etc/profile. Add the following content at the bottom of the file: PATH=/usr/local/mysql/bin:$PATHexport PATH. Save and exit. Enter the command to make the configuration take effect immediately: source /etc/profile

13. After installing MySQL, the default root account is empty. Let's change the password. Enter the command: mysql -uroot. Press Enter, and then enter the command: SET PASSWORD = PASSWORD('123456');

After the settings are completed, enter the command: quit; to exit the MySQL environment;

14. After setting the mysql password, you need to enter the following command to log in to mysql correctly: Enter the command: mysql -uroot -p After pressing Enter, you will be prompted to enter the password. After entering it correctly and executing it, you will see a prompt line starting with mysql>, where you can enter any valid sql query statement: for example, enter: show databases; to display all databases. Note that the semicolon at the end cannot be lost, it marks the end of a line of commands.

At this point, congratulations, mysql has been installed successfully.

You may also be interested in:
  • Notes on compiling and installing MySQL 5.6 in Linux environment
  • MySQL 5.6.27 Installation Tutorial under Linux
  • MYSQL5.6.33 database master/slave (Master/Slave) synchronization installation and configuration details (Master-Linux Slave-windows7)
  • Linux CentOS6.5 yum install mysql5.6
  • Detailed explanation of Lamp environment construction Linux CentOS6.5 compile and install mysql5.6
  • How to change the character set encoding to UTF8 in MySQL 5.5/5.6 under Linux
  • MySQL 5.6.33 installation and configuration tutorial under Linux
  • MySQL 5.6.28 installation and configuration tutorial under Linux (Ubuntu)
  • Tutorial on installing mysql5.6.20 from source code under linux
  • Tutorial on installing MySQL 5.6.20 using Linux binary universal package
  • Install mysql-5.6.12-linux-glibc2.5-x86_64.tar.gz under Linux
  • Detailed version of the graphic tutorial for installing MySQL 5.6.17 under Linux
  • MySQL 5.6.17 installation graphic tutorial under Linux
  • How to install MySQL 5.6 from source code under SUSE Linux
  • Installation and configuration process of linux mysql5.6 version
  • Graphic tutorial for installing mysql-5.6.4 under Linux
  • Install MySQL database 5.6 source code under Linux and change the login user password

<<:  Vue implements book management case

>>:  How to decompress multiple files using the unzip command in Linux

Recommend

Complete steps to quickly build a vue3.0 project

Table of contents 1. We must ensure that the vue/...

Vue implements scrollable pop-up window effect

This article shares the specific code of Vue to a...

Display mode of elements in CSS

In CSS, element tags are divided into two categor...

JavaScript implements Tab bar switching effects

Here is a case that front-end developers must kno...

How to encapsulate axios in Vue

Table of contents 1. Installation 1. Introduction...

Undo log in MySQL

Concept introduction: We know that the redo log i...

Use three.js to achieve cool acid style 3D page effects

This article mainly introduces how to use the Rea...

An example of how to implement an adaptive square using CSS

The traditional method is to write a square in a ...

Sitemesh tutorial - page decoration technology principles and applications

1. Basic Concepts 1. Sitemesh is a page decoratio...

How to use iostat to view Linux hard disk IO performance

TOP Observation: The percentage of CPU time occup...

CentOS 8 Installation Guide for Zabbix 4.4

Zabbix server environment platform ZABBIX version...

HTML table tag tutorial (21): row border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

CentOS 7 method to modify the gateway and configure the IP example

When installing the centos7 version, choose to co...

Sequence implementation method based on MySQL

The team replaced the new frame. All new business...

How to use CSS to center a box horizontally and vertically (8 methods)

Original code: center.html : <!DOCTYPE html>...