Install Virtual machine: Redhat+centos
I said slightly will not be beaten, haha, the installation of this virtual machine after I make up the bar ~ ~
- First look at the MySQL-related packages that have been installed
Rpm-qa | grep MySQL
The following results occur after execution, but this is only a toolkit that comes with MySQL, which is not actually installed
In the CentOS6.9 with Yum can be installed, mainly behind some of the configuration
- So let's take a look at Yum-installable MySQL-related packages
Yum List | grep ^mysql
You can see that Yum provides the following MySQL installation package, we need is red box logo two modules, server and client, only install these two, related dependent package Yum will automatically install
- The next step is to install, execute the following command, the process may need to make a few choices, always select Y to
Yum Install Mysql-devel Mysql-server
- To verify that the installation was successful, remember the RPM command that was first mentioned ~ ~
Rpm-qa | grep MySQL
The discovery has been installed successfully
Service mysqld Start
See, this note started successfully.
- Then you can now connect to the database to operate ~ ~ ~
Mysql-uroot-p
It means to connect to the database with the root account, enter the password after entering the prompt, the initial password is empty, so directly return to the following interface, you can execute SQL
show databases;
Here the database is installed, but it is recommended that we do some follow-up to facilitate the future
- Modify the encoding set, the proofing set, and the storage engine for the database, and enter the following command at the command line of MySQL
like ' %char% ' like'%colla%';
Show variables like '%engin% '
The result is that I have changed the results of the configuration file, if you find that you have found the results and not always, then to modify the configuration file
- Modify the MySQL configuration file and restart the service, the configuration file is in the/etc/directory
/etc/my.cnf
Add the following code to the location shown in the figure, then save it, save it as ESC and enter: WQ
character-set-server=utf8collation-server=utf8_general_cidefault-storage-engine=INNODB[ Client]default-character-set=utf8
Restart Service
Service mysqld Restart
See the following interface to show that the restart was successful
The SQL that can be executed before viewing the encoding set should see that it has been set in the configuration file ^_^
Linux environment installation MySQL