How to install mysql using yum in linux
My blog previous (http://blog.csdn.net/tjcyjd/article/details/41646889) has talked about the yum source configuration, with yum then install mysql will be very simple, specific as follows:
1. Install the client and the server to check whether mysql is installed:
yum list installed mysql*rpm -qa | grep mysql*
Check whether the installation package exists:
yum list mysql*
Install the mysql client:
yum install mysql
Install the mysql server:
yum install mysql-serveryum 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 -add mysqld
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:
mysqladmin -u root password 666666
Logon:
Mysql-u root-p
If you forget the password, run the following code:
service mysqld stopmysqld_safe --user=root --skip-grant-tablesmysql -u rootuse mysqlupdate user set password=password("666666") 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;flush privileges;
% 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)