How to install mysql using yum in linux
1. Install the client and server
Check whether mysql is installed:
?
12 |
yum list installed mysql* rpm -qa | grep mysql* |
Check whether the installation package exists:
?
Install the mysql client:
?
Install the mysql server:
?
12 |
yum install mysql-server yum install mysql-devel |
2. Start and Stop settings
Database Character Set settings
Add default-character-set = utf8 to the mysql configuration file/etc/my. cnf.
Start the mysql service:
?
Or/etc/init. d/mysqld start
Set boot start:
?
Check whether startup setting is successful
?
1 |
chkconfig --list | grep mysql* |
Mysqld 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable
Stop mysql service:
?
3. login and forgot to change the password
Create a root administrator:
?
1 |
mysqladmin -u root password 666666 |
Logon:
Mysql-u root-p
If you forget the password, run the following code:
?
123456 |
service mysqld stop mysqld_safe --user=root --skip-grant-tables mysql -u root use mysql update user set password = password ( "666666" ) where user = "root" ; flush privileges ; |
4. Allow Remote Access settings
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 ".
?
12 |
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 directory
/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)