mysql installation and configuration

MySQL installation and configuration of several ways of problem summary

This article mainly introduces the MySQL installation and configuration of several ways, and then at the bottom of the article to introduce you to the installation process of the problem summary, very good, with a reference value, the need for friends can refer to

1, MySQLrpm package installation

#Download the installation source


#Install the source

[root@ localhostsrc]#rpm-ivhmysql-community-release-el7-5.noarch.rpm2, MySQL yum tool installation

[root@localhost/]#yuminstall-ymysql-community- server

#View the installed file path



/usr/bin/ mysqld_safe


/usr/bin/mysqlmpFor a detailed list of the files included in each package, you can use the “rpm-ql software name” command, which lists the current This command lists the current rpm package files and where they are installed. issuer




/usr/share/doc/openssl-1.0. 1e/CHANGES

…… .3. MySQL Source Installation

#Install packages required for compilation

[root@localhostsrc]#yuminstall-ymakegcc-c++cmakebison-develncurses- develgccautoconfautomakezlib*fiex*libxml*

#Download source code

[root@localhostsrc]#wget mysql-5.6.24.tar.gz

#Unpack the source package



< p>#Compile and configure, this process will take 3~5 minutes



-DMYSQL_ DATADIR=/data/mysql/data\











#Compile and install

#The compilation process takes about 30~50 minutes



#Set up MySQL user and groups



[root@ localhostmysql-5.6.24]#cd/usr/local/mysql/

#Set permissions so that mysql can modify files


[root@ localhostmysql]#chown-Rmysql:mysql/data/mysql/data

#Initialize the database

#It is important to note that the data directory set here should be the same as the one specified in the previous MYSQL_DATADIR

[root@ localhostmysql]#scripts/mysql_install_db –user=mysql-ldata=/data/mysql/data

#Restore the permissions settings and change the permissions of the appropriate directories for mysql to modify

[root@ localhostmysql]#chown-Rroot./

[root@localhostmysql]#chown-RmysqldataThe above example indicates installing the MySQL software into the /usr/local/mysql directory, and the parameters and their meanings used in this example are as follows:

DCMAKE_INSTALL_PREFIX: Indicates where MySQL will be installed, in this case it will be installed in the /usr/local/mysql directory;

DMYSQL_DATADIR: Indicates the directory in which MySQL data files are stored; DSYSCONFDIR: The directory in which the configuration files are located;

DWITH_MYISAM_STORAGE_ENGINE: compiles the MyISAM storage engine into the service;

DWITH_INNOBASE_STORAGE_ENGINE: compiles the InnoDB storage engine into the service;


DMYSQL_TCP_PORT: port used by default; DENABLED_LOCAL_INFILE: specifies whether or not to allow local execution of LOADDATA

INFILE; DWITH_PARTITION_STORAGE_ENGINE: compiles the partitioning engine into the service;

DEXTRA_CHARSETS: make the service support all extended character sets; DDEFAULT_CHARSET: the default character set used by the service, set here to

UTF8; DDEFAULT_COLLATION: the default sorting rules.

There are many parameters when compiling and installing MySQL, the detailed meanings and descriptions of these parameters can be found in the official website:

Installed dependencies Packages:

gcc/g++: MySQL 5.6 onwards, you need to use g++ to compile; cmake: MySQL 5.5 onwards, use cmake for project management, cmake needs version 2.8 or above; bison: MySQL syntax parser needs to be compiled using bison; ncurses- devel: development package for terminal operation; zlib: MySQL uses zlib for compression; libxml: for XML input and output method support; openssl: use openssl secure socket method of communication;

dtrace: used to diagnose MySQL problems.

Completing the above installation steps is not enough; you also need to add configuration options, start-stop scripts, and so on for MySQL.


#Remove comment lines in the configuration file to show only valid lines


#Put the startup scripts in the /etc/init.d directory

cpsupport-files/ mysql.server/etc/init.d/mysqld

#Add mysql as a system service



#At this point, MySQL’s root user does not have a password.


#Since the password has not been set yet, you can just press Enter

#Set the password for the root user to 888888

#Set password=password(‘888888’);

#Type quit to exit when setup is complete

quitAttachment: Summary of problems during installation

1, -bash:mysql:commandnotfound

Because the command path for mysql is in /usr/library/library/library/library/library/library/library/library/library/library. path is under /usr/local/mysql/bin, so when you use the mysql command directly, the system checks for this command under /usr/bin, so it can’t be found.

Solution: just use the following command to make a link

ln-s/usr/local/mysql/bin/mysql/usr/bin2、StartingMySQL….TheserverquitwithoutupdatingPIDfile([FAILED] /mysql/


Modify datadir in /etc/my.cnf to point to the correct mysql database file directory

3. ERROR2002(HY000):Can’tconnecttolocalMySQLserverthroughsocket ‘/tmp/mysql.sock'(2)


Create a new link or add the -S parameter to mysql to point directly to the mysql.sock location.


/usr/local/mysql/bin/mysql-uroot-S/usr/local/mysql/data/mysql. sock

mysql5.7 how to install mysql5.7 installation and configuration tutorial

This article provides you with the Mysql installation package, detailed installation steps, as well as solutions to problems in the installation process, I hope to help you ……

Tools: Mysql5.7.12.0 Installer Download


Click on the download of the installation tool, go to the first step, select I accept the agreement, select next as shown in the picture

Choose to install DeveloperDefault that is, to install all the tools you need to use MySQL, select next

Select Execute to configure the tools listed above, select Yes in the warning box that pops up, and then select next when the configuration is complete;

Select Execute to configure, and then select next when the configuration is complete

The following selection of next is completed according to the defaults all the way to AccountsandRoles Installation steps

As shown in the figure AccountsandRoles installation steps: fill in the MySQL root password (password at least four digits), select next

The following in accordance with the default click on next, in the ApplyServerConfiguration installation steps to select Execute to configure the configuration, configuration Finish by selecting next

In the ConnecttoServer installation step: as shown in the figure click Check to change the username and password, you can

Select Execute to configure only need to select next until finish

Verify whether the installation is successful: select all programs in the computer to find the MySQL: MySQL5.7CommandLineClient,click run, enter the password, shows mysql> then indicates that the login is successful

Highlights of the topic to share:

mysql different versions of the installation tutorials

mysql5.6 various versions of the installation tutorials

mysql5.7 various versions of installation tutorial

mysql8.0 various versions of installation tutorials

How to configure environment variables after installing mysql on win10 systemMethods to configure mysql environment variables on win10 system

If we don’t configure environment variables after installing mysql on windows 10, we have to enter the mysql installation directory when using the command line for mysql operation. This operation will feel very troublesome. What should I do? Below, I will share with you the way to configure mysql environment variables in Win10 system.

Specific methods are as follows:

1, keyboard key combination: Win + i, open the settings window, click “System”, enter the system settings;

2, in the system settings window, select “About “-“Systeminfo”;

3. Select “Advancedsystemsettings” in the window that appears;

4. “SystemProperties” window, select “EnvironmentVariables”;

5, in the ” EnvironmentVariables” window in the “Systemvariables” find “Path”, and click ” Edit” for editing;

6, in the “Editenvironmentvariable” window, select “New” to create a new environment variable;

7, in the input box, enter the installation path of mysql to the bin directory;

such as: C:\ProgramFiles\MySQL\MySQLServer5.7\bin

8, how to open the window in the previous select “Ok”, so that mysql is completed. to this point, complete mysql in win10build10565 in the configuration of environment variables;

9, use the key combination: Win + R, open the run window, enter: cmd, open the command line window;

10, in the command line window, enter: mysql-uroot-p, enter enter mysql’s password, you can enter the mysql.

The above is the specific method of configuring mysql environment variable in win10 system is introduced. Users who need it, you can follow the method shared by me!