linux-mysql install and uninstall

A, mysql installation

1. Install the rpm package
directly using an advanced version of yum -y install command to install mysql mysql is not installed, you need to install the rpm package mysql5 series with the resources available in the community edition, enter the following command to install
the command: rpm -Uvh HTTP: //dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2. Check mysql version available
and then use the following command to view the available version of mysql
command: yum repolist Enabled | grep "mysql * - * Community Community.."

3. Install mysql
then you can begin to install mysql, and generally we only need to install mysql-server and mysql-client on it.
Enter a command to start the installation mysql installation
command: yum the install mysql--Y-Community Server
installation detection relies on their own yum install package download, wait for the installation can be completed

You can use the command make mysq added service boot (optional): systemctl enable mysqld

4. Turn mysql service
using the mysql command to start the service after successful installation: systemctl Start mysql
using mysql command to view the status: systemctl Status mysql

5. Create user and log mysql
use the command to create a user: mysqladmin-uroot-root password

When users create a red box will appear warning the contents of the map, which means using a password is not secure on the command-line interface, you can skip directly.

User login using mysql just created

So far, CentOS7 system successfully install mysql

6. Use navicat mysql connection
required would let users grant permission before using telnet connection navicat mysql, mysql would otherwise be unable to connect
after Log on mysql, use the following commands for remote login authorization
grant all privileges on *. * To 'root '@'% 'IDENTIFIED by' root 'with the Option Grant;
flush privileges;

It is then used to connect mysql navicat, as shown below "connection successful"

Note:
Sometimes when installing some files using yum, the following occurs:
Another App IS Rate this page Currently Holding at The yum Lock; Waiting for IT to Exit ...
at The OTHER IS the Application: PackageKit
can turn off the process by forcing yum: rm -f / var / run / yum.pid
then you can use the yum.

Two, MySQL uninstall
1. mysql View installed
command: RPM -qa | grep -i MySQL

2. Uninstall mysql
command: yum the Remove-Server-mysql-Community Community 5.6.36-2.el7.x86_64

View other dependent mysql: RPM -qa | grep -i mysql
using yum remove mysql-xxx click Uninstall, know all the other rely mysql uninstall far

3. Delete the mysql directory
using the mysql command to view related files in the directory: the Find / -name mysql

Rm -rf command to delete files using mysql directory

So far mysql has been successfully uninstalled

 

Third, add files to mysql sql and execute content

1, mysql database client connections

[root@iZbp1bb2egi7w0ueys548qZ ~]# mysql -h rm-k1h7gjp9s3dd5c8a7.mysql.rds.aliyuncs.com -u root -p

Will be entered into the database password after a carriage return

 

2, switching database use e_user;

3, execute sql file, / usr / t_user_alpha.sql path is the path to the mysql client, mysql command line, enter the path to press the Tab key is not automatically fill the whole, we need to knock yourself

MySQL [e_user]> source /usr/t_user_alpha.sql

Published 84 original articles · won praise 149 · views 50000 +

Guess you like

Origin blog.csdn.net/feifeiyechuan/article/details/102580136