Under the mysql rpm linux install yum install and uninstall

rpm installation

1. mysql packages uploaded to root (where all lines) (MySQL-Server-5.5.47-1.linux2.6.x86_64.rpm server, MySQL-client-5.5.47-1.linux2.6.x86_64 .rpm client) download link: link: https: //pan.baidu.com/s/1TuWR6kceNNOcy0H_LEEftQ password: p8gl

2. Uninstall the existing database

rpm -qa | grep mysql

rpm -e mysql-libs-5.1.66-2.el6_3.i686 --nodeps

rpm -ivh MySQL-server-5.1.73-1.glibc23.i386.rpm

rpm -ivh MySQL-client-5.1.73-1.glibc23.i386.rpm

3. Perform rpm -ivh MySQL-server-5.5.47-1.linux2.6.x86_64.rpm

错:Failed dependencies: /usr/bin/perl is needed by MySQL-server-5.5.47-1.linux2.6.x86_64.rpm

libaio.so.1()(64bit) is needed by MySQL-server-5.5.47-1.linux2.6.x86_64.rpm

libaio.so.1(LIBAIO_O.1) is needed by MySQL-server-5.5.47-1.linux2.6.x86_64.rpm

libaio.so.1(LIBAIO_O.4) is needed by MySQL-server-5.5.47-1.linux2.6.x86_64.rpm

The reason: lack of dependent libraries

Resolution: Using yum list | grep perl find the package using yum -y install perl.x86_64 installation

yum -y install libaio.x86_64 re-install mysql execution of sentence

4. Turn service service mysql start

Modify the mysql password / usr / bin / mysql_secure_installation

Execute this script, you can follow the set (Note: delete anonymous users, allows users to connect remotely)

Enter current password for root (enter for none): here without a password, you do not need any input

set a new root password? Enter Y

enter a new root password: password

Remove anonymous users? [Y / n] whether you need to user input n

Disallow root login remotely? [Y / n] Are not allow remote login, enter n behind are input to Y

yum install source

Solution: giving root privileges

First stop MySQL service: service mysqld stop

Add parameters to start mysql: / usr / bin / mysqld_safe  --skip-grant-tables & then you can not access any of the restrictions mysql

 

The first step, the next to see whether the CentOS install mysql

Enter the command: yum list installed | grep mysql

Step 2, to delete the installed mysql

Enter the command: yum -y remove mysql

See complete that success

Step 3 Check yum repository mysql (non-essential)

Enter the command: yum list | grep mysql

Step 4, the mounting yum library mysql

Enter the command: yum -y install mysql mysql-server

Step 5, to start MySql service

Note: Before you turn on mysql, first execute / usr / bin / mysqld_safe --skip-grant-tables &, you can root privileges fully open

Enter the command: service mysqld start

Step 6, change passwords

method one:

mysql > use mysqld; mysql > update user set password=‘123456‘ where user=‘root‘;

Method Two:

Modify the mysql password / usr / bin / mysql_secure_installation

Execute this script, you can follow the set (Note: delete anonymous users, allows users to connect remotely)

Enter current password for root (enter for none): here without a password, you do not need any input

set a new root password? Enter Y

enter a new root password: password

Remove anonymous users? [Y / n] whether you need to user input n

Disallow root login remotely? [Y / n] Are not allow remote login, enter n behind are input to Y

Step 7, open remote logon rights

Let telnet: If the problem does not appear permission, (executed on the machine to install mysql's) authorization in mysql

mysql -uroot -p

(Execute the following statement: all tables in all library%: Any IP address or host can be connected)

Enter the command Description: GRANT ALL PRIVILEGES ON TO 'root' @ '%' IDENTIFIED BY 'your password' WITH GRANT OPTION;.

So that the client has permission to remote login, password reset to mysql

输入命令:GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'mysql' WITH GRANT OPTION;

Enter the command: FLUSH PRIVILEGES;

So that the client has permission to log on locally, mysql password reset to

输入命令:grant all privileges on . to root@"localhost" identified by "mysql" with grant option;

Enter the command: FLUSH PRIVILEGES;

Step 8, set the boot (non-essential)

chkconfig mysqld on

 

Note: mysql equivalent of open mysql client services using

mysqld is the mysql server process

 

Uninstall ...

1. First check the installation mysql

rpm -qa|grep -i mysql

Before installing the display:

MySQL-client-5.5.25a-1.rhel5MySQL-server-5.5.25a-1.rhel5

2. Stop the mysql service, and remove the package

rpm -ev MySQL-client-5.5.25a-1.rhel5 rpm -ev MySQL-server-5.5.25a-1.rhel5

If prompted dependencies error, try using the following command rpm -ev MySQL-client-5.5.25a- 1.rhel5 --nodeps

If an error: error:% preun (xxxxxx) scriptlet failed, exit status 1

Then try using the following command: RPM --noscripts -e MySQL-Client-5.5.25a-1.rhel5

3. Find the directory before the old version of mysql, mysql and delete old versions of files and libraries

Copy the code find / -name mysql

/ Var / lib / mysql

/ Var / lib / mysql

/mysql/usr/lib64/mysql

Delete the corresponding mysql directory

rm -rf /var/lib/mysql

rm -rf /var/lib/mysql

rm -rf /usr/lib64/mysql

Note: /etc/my.cnf not deleted after uninstalling, you need to manually delete

rm -rf /etc/my.cnf

4. Find again the machine is installed mysql

rpm -qa | grep -i mysql no results, explained that it had completely uninstall

Guess you like

Origin www.cnblogs.com/bihaiba/p/11546306.html