Objective:
Linux installation of MySQL and configuration management, basic operations and management will need some. Take notes here in order to make the day up (^_^).
Installation process:
*). Installing Mysql-server
1). Retrieve the relevant MySQL RPM package with Yum
Yum Search MySQL
Mysql-server.x86_64 is exactly what we want.
2). Install Mysql-server
Yum Install Mysql-server.x86_64-y
The default mysql-client is also installed.
3). Start the MySQL service
/etc/init.d/mysqld start
4). Manage Users
Mysql-u root-p
The root user's default password is empty
5). Add User Rights
GRANT all privileges in <database_name>.<table_name> to <username>@ ' <ip> ' identified by ' < Password> '
, all permissions on all tables in all libraries are given to (username= ' Hiveuser ', password= ' Hivepass '), and the login address is not restricted.
In fact, the permission table, defined in the Mysql.user table
Mysql> Show CREATE TABLE mysql.user\g; Create table:create Table ' user ' (' Host ' char (COLLATE) utf8_bin not NULL DEFAULT ' ', ' user ' char (+) COLLATE Utf8_b In NOT null default ', ' Password ' char (CHARACTER SET latin1 COLLATE latin1_bin NOT null default ' ', # middle omitted .... PRIMARY KEY (' Host ', ' User ') Engine=myisam DEFAULT charset=utf8 collate=utf8_bin comment= ' Users and global privileges '
Note: PRIMARY key is a federated primary key (' Host ', ' User ')
User authentication, password is encrypted password
Mysql-server is deployed on the TW-NODE6 machine and is validated on another and its tw-node7 login
But is the local MySQL client going to the MySQL server missing always fail?
It appears that '% ' does not contain local and requires additional IP as ' localhost ' to be added
To verify:
6). Process Analysis
Simple PS under related processes
Process: Mysqld is the real MySQL service process
Process: Mysqld_safe, which is actually a monitoring script for the MYSQLD service process, is used to start, and restarts the service after the mysqld exits, similar to the famous supervise
[Email protected] ~]# file/usr/bin/mysqld_safe/usr/bin/mysqld_safe:posix shell script text Executable[[email protecte D] ~]# file/usr/libexec/mysqld/usr/libexec/mysqld:elf 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically Linke D (uses shared libs), for Gnu/linux 2.6.18, stripped
And/etc/init.d/mysqld is called/usr/bin/mysqld_safe, which indirectly initiates the MYSQLD service.
7). Configuration Management
In the edit/etc/my.cnf
[mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# disabling Symbolic-links is recommended To prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/ Mysqld.logskip-name-resolvepid-file=/var/run/mysqld/mysqld.pid
A lot of configuration items are omitted here.
For example, in [Mysqld] under the Skip-grant-tables, when the administrator forgot the account password, you can use this to recover.
For example, in [Mysqld] under the skip-name-resolve, avoid domain name resolution, prevent external machine connection mysql-server, cause slow query
Socket=/var/lib/mysql/mysql.sock, or Mysql.sock, is used to connect to the MySQL service with Mysql.sock
Like Mysql-s/var/lib/mysql/mysql.sock, which is quite handy.