First, Description: This culture and education everyone in the Linux online installation of MySQL. Many articles on the internet are too messy to write, we only take the most convenient way to install online. This article takes CentOS as an example.
Second, the installation process.
1. Install client and server:
(1) Check if you have installed:
Yum List installed mysql*
Rpm-qa | grep mysql*
(2) To see if there is an installation package:
Yum List mysql*
(3) Install the MySQL client:
Yum install MySQL
(4) Install MySQL server:
Yum Install Mysql-server
Yum Install Mysql-devel
Note: It is also possible to install only mysql-server.
Mysql-devel is some of the required libraries and include files if you want to compile other MySQL client programs, such as Perl modules.
(5) Setting character Set encoding:
MySQL config file/etc/my.cnf add Default-character-set=utf8
2, start, stop the service.
(1) Start-up service:
Service mysqld Start
(2) Stop the service:
Service Mysqld Stop
(3) Set to boot automatically:
Chkconfig mysqld on
3, login and forget password processing.
(1) Create root administrator:
Mysqladmin-u Root Password 123456
(2) Log in to MySQL:
Mysql-u root-p
(3) If you forgot your password:
Service Mysqld Stop
Mysqld_safe--user=root--skip-grant-tables
Mysql-u Root
Use MySQL
Update user set Password=password ("123456") where user= "root";
Flush privileges;
4. Allow remote access settings.
Use MySQL;
UPDATE user SET ' Host ' = '% ' WHERE ' user ' = ' root ' LIMIT 1;
5. Port number of open firewall
MySQL Add permission: The user table in the MySQL library has a new record of "%" and the user is "root".
Use MySQL;
UPDATE user SET ' Host ' = '% ' WHERE ' user ' = ' root ' LIMIT 1;
% means all IP access is allowed
6. Several important directories of MySQL
(a) Database directory
/var/lib/mysql/
(b) configuration files
/usr/share/mysql (mysql.server command and configuration file)
(c) Related orders
/usr/bin (Mysqladmin mysqldump and other commands)
(d) Startup scripts
/etc/rc.d/init.d/(startup script file for MySQL directory)
Linux Online install MySQL and modify password settings service startup