By mounting mysql rpm package under Linux

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qqyb2000/article/details/89465196

A local check whether other versions of mysql installed
[root @ james ~] # RPM -qa | grep -i mysql
MySQL-Client-5.5.48-1.linux2.6.x86_64
MySQL-Server-5.5.48-1 .linux2.6.x86_64

II. If you need to uninstall the installed

[root@james ~]# rpm -e --nodeps MySQL-client-5.5.48-1.linux2.6.x86_64
[root@james ~]# rpm -e --nodeps MySQL-server-5.5.48-1.linux2.6.x86_64

III. Mysql copy installation package
Here Insert Picture Description

IV. Mysql installation file
[root @ james ~] # rpm -ivh MySQL-server-5.5.48-1.linux2.6.x86_64.rpm

Here Insert Picture Description
[root @ james ~] # rpm -ivh MySQL-client-5.5.48-1.linux2.6.x86_64.rpm
Here Insert Picture Description
V. After successful installation, enter mysql to change the password
1. First, start the service
[root @ james ~] # mysql Start Service
2. then log
[root @ james ~] # mysql
3. into the mysql database
Here Insert Picture Description
4. Modify the root account password
Here Insert Picture Description
5. fortune increased access to root privileges
GRANT ALL pRIVILEGES ON . the tO 'root' @ '%' IDENTIFIED BY 'tiger'
Here Insert Picture Description
password tiger here for you to add permissions set by the user,% represents all hosts can also be specific to your host ip address
6. permission to refresh
flush privileges; this step must be done, or can not succeed! Phrase represents reload grant permission to data from the table mysql database
because the MySQL privileges are placed in the cache, so the need to reload after the finish to change.
7. add new users to the database
MySQL> the ON the GRANT ALL PRIVILEGES . The TO 'Andy' @ '%' the IDENTIFIED BY 'Tiger';
Here Insert Picture Description
8. The user table query command again: select User, authentication_string, Host from user
Here Insert Picture Description
Found that more than a few users, the user can access all of the hosts, this time again with the client access connection is successful

six. (If not accessible, turn off the firewall) via the remote connection client terminal database
; 1. [James the root @ ~] # iptables STOP-Service
Here Insert Picture Description
2. Test connector
Here Insert Picture Description
3 can be used after entering navicat
VII. Character encoding modification data
1. Copy profile
CP /usr/share/mysql/my-medium.cnf /etc/my.cnf
2. Modify configuration
1), was added in the default-character-set [client] field = utf8 , as follows:
[Client]
Port = 3306
Socket = /var/lib/mysql/mysql.sock
default-Character-SET = UTF8

2、在[mysqld]字段里加入character-set-server=utf8,如下:

[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
character-set-server=utf8

3、在[mysql]字段里加入default-character-set=utf8,如下:
[mysql]
no-auto-rehash
default-character-set=utf8

3. Restart mysql server
Here Insert Picture Description
VIII. If you want to automatically open when you start linux mysql service, automatically turn off the firewall, you can use the chkconfig command
Here Insert Picture Description
the following two commands are open mysql, close iptables
chkconfig --level 35 MySQL ON
chkconfig iptables --level 345 OFF

Examples of use:
chkconfig --list # list all system services
chkconfig --add httpd # service httpd increase
chkconfig --del httpd # delete httpd service
chkconfig --level 2345 httpd on # Set httpd running level 2, 3, 4 and 5 is the case where the on (open) state
chkconfig --list # listing system where all services start
chkconfig --list mysqld # lists services provided mysqld case
chkconfig --level 35 mysqld on # set mysqld in level 3 and 5 serve for the power running, -level 35 indicates the operation performed only in level 3 and 5, indicating that the startup oN, oFF means closed
chkconfig mysqld on # mysqld set to oN at each level, "each level" includes 2, 3,4,5 grade
how to add a service:
1. service script must be stored in /etc/ini.d/ directory;
2.chkconfig --add SERVICENAME
increase this service chkconfig tool in the list of services, in which case the service will be /etc/rc.d/rcN.d imparted in K / S of the inlet;
3.chkconfig --level mysqld oN 35
changes to the default level of service is started.

Guess you like

Origin blog.csdn.net/qqyb2000/article/details/89465196