Today I sorted out the installation of mysql database in Linux environment
Required environment and materials: linuxCentOS6.5, mysql-community-release-el6-5.noarch.rpm,
(Note: I am using a linux virtual machine here)
If there is a mysql file or package in the linux server, it must be uninstalled cleanly, otherwise the installation will fail. I will mention how to uninstall the package at the bottom.
First, download the yum source package of mysql corresponding to the linux system from the oracle official website, namely:
mysql-community-release-el6-5.noarch.rpm
Upload the yum source package to linux and install it.
[root@bogon file location]# yum localinstall mysql-community-release-el6-5.noarch.rpm
[root@bogon file location]# yum install mysql-server
start mysql
[root@bogon ~]# service mysqld start
In this way, mysql will remind the user to set the root password in the message after start, and it will also display the command line in the message as shown below
/usr/bin/mysqlamin -uroot password 'new-password'
The 'new-password' of the command line here is the location of the password that needs to be modified and set
For example I need to change the password to admin
即:[root@bogon ~]/usr/bin/mysqlamin -uroot password 'admin'
Enter the mysql command: [root@bogon ~]mysql -uroot -padmin
At present, the installation of mysql has been completed, so if you need to remotely control the mysql database or use navicat to operate the database
Then you need to turn off the firewall of the system and enter mysql to set up remote authorization
Turn off the firewall: service iptables stop
Remote authorization: [root@bogon ~]mysql -uroot -padmin
mysql>GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
__________________________________________________ Golden Section ___________________________________________
Now let's introduce some early mysql operations:
First enter the command to view the path of mysql in the linux environment:
example
[root@bogon ~]# whereis mysql
mysql:xxx/xxx/mysql xxx/xxx/mysql xxx/xxx/mysql
At this point, the mysql file exists in the current environment
You can also view the mysql installation package
E.g:
[root@bogon ~]# rpm -qa|grep mysql
mysql-community-client-5.6.26-2.el6.i686
mysql-community-release-el6-5.noarch
Uninstall mysql:
[root@bogon ~]# yum remove mysql*
In this way, all mysql can be uninstalled.
__________________________________________________ Golden Section ___________________________________________
In addition, load a common command of mysql to check whether the installation is successful mysql
https://www.cnblogs.com/xdpxyxy/archive/2012/11/16/2773662.html