Use yum to install mysql in CentOS
1. Install the client and the server to check whether mysql is installed:
1. yum list installed mysql *
2. rpm-qa | grep mysql *
Check whether the installation package exists
1. yum list mysql *
Install the mysql client
1. yum install mysql
Install the mysql server:
1. yum install mysql-server
2. yum install mysql-devel
? 2. Start and Stop setting database character set settings
Add default-character-set = utf8 to the mysql configuration file/etc/my. cnf.
Start the mysql service:
Service mysqld start
Or/etc/init. d/mysqld start
Set boot start:
Chkconfig mysqld on
Check whether startup setting is successful
Chkconfig -- list | grep mysql *
Mysqld 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable
Stop mysql service:
Service mysqld stop
3. log on to and forget to change the password to create a root administrator:
1. mysqladmin-u root password Aa12345
Logon:
Mysql-u root-p
If you forget the password, run the following code:
Service mysqld stop
Mysqld_safe -- user = root -- skip-grant-tables
Mysql-u root
Use mysql
Update user set password = password ("Aa12345") where user = "root ";
Flush privileges;
4. Allow Remote Access and set the port number of the open Firewall
Mysql adds permissions: the user table in the mysql database adds a record with host as "%" and user as "root ".
Use mysql;
UPDATE user SET 'host' = '%' WHERE 'user' = 'root' LIMIT 1;
% Indicates that all ip addresses are allowed to access
5. Several important mysql directories (a) Database Directories
/Var/lib/mysql/
(B) configuration file
/Usr/share/mysql (mysql. server command and configuration file)
(C) Related commands
/Usr/bin (commands such as mysqladmin mysqldump)
(D) Startup Script
/Etc/rc. d/init. d/(directory for starting the script file mysql)