I tried to build a simple LAMP environment, but I found that there are so many problems. (By default7 # zbphp.com)
In many cases, the prompt for installing Mysql is via yum one-click installation. The shell command is as follows:
yum install mysqlyum install mysql-serveryum install mysql-devel
However,The mysql version installed with this command is old.Mysql version 5.1.0x is already 5.6.x on the official website. It's too old. I remember that version 5.1 came out in.
Install the rpm-.tar installation package on mysqlofficial network, which is about MB. Linux64.
[root@localhost mysqlinstall]# ls MySQL-client-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-devel-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-embedded-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-shared-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-test-5.6.19-1.linux_glibc2.5.x86_64.rpm[root@localhost mysqlinstall]# pwd/home/default7@zbphp.com/Downloads/mysqlinstall[root@localhost mysqlinstall]#
However, installation is always performed according to the step-by-step prompts on the Internet (CSDN blog and blogcn blog), but there are always various problems and problems that cannot be run.
The installation was successful after several attempts, and the operation was normal:
[root@localhost /]# yum remove mysqlLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessNo Match for argument: mysqlLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.comPackage(s) mysql available, but not installed.No Packages marked for removal[root@localhost /]# yum remove mysql-serverLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package MySQL-server.x86_64 0:5.6.19-1.linux_glibc2.5 will be erased--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Removing: MySQL-server x86_64 5.6.19-1.linux_glibc2.5 installed 248 MTransaction Summary================================================================================Remove 1 Package(s)Installed size: 248 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Erasing : MySQL-server-5.6.19-1.linux_glibc2.5.x86_64 1/1 Verifying : MySQL-server-5.6.19-1.linux_glibc2.5.x86_64 1/1 Removed: MySQL-server.x86_64 0:5.6.19-1.linux_glibc2.5 Complete![root@localhost /]# yum remove MySQL-*Loaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessResolving Dependencies--> Running transaction check---> Package MySQL-devel.x86_64 0:5.6.19-1.linux_glibc2.5 will be erased---> Package MySQL-shared.x86_64 0:5.6.19-1.linux_glibc2.5 will be erased---> Package MySQL-shared-compat.x86_64 0:5.6.19-1.linux_glibc2.5 will be erased--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64--> Running transaction check---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be erased--> Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Removing: MySQL-devel x86_64 5.6.19-1.linux_glibc2.5 installed 17 M MySQL-shared x86_64 5.6.19-1.linux_glibc2.5 @/MySQL-shared-5.6.19-1.linux_glibc2.5.x86_64 7.8 M MySQL-shared-compat x86_64 5.6.19-1.linux_glibc2.5 @/MySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64 11 MRemoving for dependencies: perl-DBD-MySQL x86_64 4.013-3.el6 @base 338 kTransaction Summary================================================================================Remove 4 Package(s)Installed size: 36 MIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Erasing : MySQL-devel-5.6.19-1.linux_glibc2.5.x86_64 1/4 Erasing : perl-DBD-MySQL-4.013-3.el6.x86_64 2/4 Erasing : MySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64 3/4 Erasing : MySQL-shared-5.6.19-1.linux_glibc2.5.x86_64 4/4 Verifying : MySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64 1/4 Verifying : MySQL-devel-5.6.19-1.linux_glibc2.5.x86_64 2/4 Verifying : MySQL-shared-5.6.19-1.linux_glibc2.5.x86_64 3/4 Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 4/4 Removed: MySQL-devel.x86_64 0:5.6.19-1.linux_glibc2.5 MySQL-shared.x86_64 0:5.6.19-1.linux_glibc2.5 MySQL-shared-compat.x86_64 0:5.6.19-1.linux_glibc2.5 Dependency Removed: perl-DBD-MySQL.x86_64 0:4.013-3.el6 Complete![root@localhost /]# yum remove MySQL-*Loaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessNo Match for argument: MySQL-*Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.comPackage(s) MySQL-* available, but not installed.No Packages marked for removal[root@localhost /]# whereis mysqlmysql: /usr/lib64/mysql[root@localhost /]# which mysql/usr/bin/which: no mysql in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/default7/bin)[root@localhost /]# yum remove MySQL-sharedLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessNo Match for argument: MySQL-sharedLoading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.163.com * updates: mirrors.163.comNo Packages marked for removal[root@localhost /]# whereis mysqlmysql: /usr/lib64/mysql[root@localhost /]# which mysql/usr/bin/which: no mysql in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/default7/bin)[root@localhost /]# yum remove MySQL-testLoaded plugins: fastestmirror, refresh-packagekit, securitySetting up Remove ProcessNo Match for argument: MySQL-testLoading mirror speeds from cached hostfile * base: mirrors.btte.net * extras: mirrors.btte.net * updates: mirrors.btte.netPackage(s) MySQL-test available, but not installed.No Packages marked for removal[root@localhost /]# clear
In fact, I have been constantly re-installing, always having problems, unable to start or report errors. The reason is that it is not correct with the first installation step, and then it will be reinstalled continuously.
HoweverNot thoroughly uninstalled. Rpm-e Mysql seems to be case-sensitive. I deleted the folder directly at first to uninstall it, and then I used rpm-e-nodeps mysql to uninstall it, but there is still a residue.
In the end, yum remove mysql, mysql-server, and mysql-shared are used to uninstall mysql. To uninstall mysql, delete mysql from all folders. Then reinstall.
[root@localhost mysqlinstall]# lsMySQL-client-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-devel-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-embedded-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-server-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-shared-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-shared-compat-5.6.19-1.linux_glibc2.5.x86_64.rpmMySQL-test-5.6.19-1.linux_glibc2.5.x86_64.rpm[root@localhost mysqlinstall]# rpm -ivh MySQL-server-*.rpmPreparing... ########################################### [100%] 1:MySQL-server ########################################### [100%][root@localhost mysqlinstall]# rpm -ivh MySQL-client-*.rpmPreparing... ########################################### [100%] 1:MySQL-client ########################################### [100%][root@localhost mysqlinstall]# rpm -ivh MySQL-devel-*.rpmPreparing... ########################################### [100%] 1:MySQL-devel ########################################### [100%][root@localhost mysqlinstall]# service mysql status ERROR! MySQL is not running[root@localhost mysqlinstall]# service mysql startStarting MySQL.. SUCCESS!
Change the password. The original password is in the/root/folder. ls-a shows a mysql file with the original password:
mysql> show databases;ERROR 1820 (HY000): You must SET PASSWORD before executing this statementmysql> select user();ERROR 1820 (HY000): You must SET PASSWORD before executing this statementmysql> set password=password('zbphp.com');Query OK, 0 rows affected (0.00 sec)mysql> show user();ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user()' at line 1mysql> select user();+----------------+| user() |+----------------+| root@localhost |+----------------+1 row in set (0.00 sec)mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+4 rows in set (0.01 sec)mysql> select version();+-----------+| version() |+-----------+| 5.6.19 |+-----------+1 row in set (0.00 sec)mysql>