Problems occurred during MySQL installation: bitsCN.com
Problems during MySQL installation
1> decompress MySQL
[html] [root@localhost test]# tar -xvf MySQL-5.6.12-2.linux_glibc2.5.i386.rpm-bundle.tar MySQL-test-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-shared-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-embedded-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-devel-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm MySQL-shared-compat-5.6.12-2.linux_glibc2.5.i386.rpm
2> install MySQL
[Html]
(1) If MySQL is already installed, the following message is displayed:
[root@localhost test]# rpm -ivh MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm Preparing... ########################################### [100%] package MySQL-server-5.6.12-2.linux_glibc2.5.i386 is already installed [root@localhost test]# rpm -ivh MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm Preparing... ########################################### [100%] package MySQL-client-5.6.12-2.linux_glibc2.5.i386 is already installed
You can uninstall MySQL first.
Run command rpm-e MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm-nodeps
[html] rpm –e MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm --nodeps
(2) If this information is not displayed, the installation will be normal.
[html] [root@localhost test]# rpm -ivh MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%] [root@localhost test]# rpm -ivh MySQL-client-5.6.12-2.linux_glibc2.5.i386.rpm Preparing... ########################################### [100%] 1:MySQL-client ########################################### [100%]
3> start MySQL
(1) solutions to exceptions when the MySQL server is started for the first time
[html] [root@localhost test]# service mysql start Starting MySQL.......................... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.pid).
The Zombie process started by mysql must be killed before it can be started.
[html] [root@localhost test]# ps -ef | grep mysql root 1953 1 0 22:18 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid mysql 2171 1953 0 22:18 ? 00:00:04 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid root 3282 1 0 22:37 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.pid mysql 3386 3282 2 22:37 pts/0 00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.err --pid-file=/var/lib/mysql/localhost.pid root 3482 2681 0 22:38 pts/0 00:00:00 grep mysql
Kill with kill-9 2171 or the like
Use service mysql start or/etc/init. d/mysql start
[html] [root@localhost test]# service mysql start Starting MySQL SUCCESS!
4> log on to MySQL
[html] [root@localhost test]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or /g. Your MySQL connection id is 2 Server version: 5.6.12 MySQL Community Server (GPL) Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
The password for the first login is ~ /. Mysql_secret
[Html] cat. after mysql_secret enters mysql, you must set a password. otherwise, no operation can be performed. if ERROR 1862 (HY000): Your password has expired is displayed. to log in you mustchange it using a client that supports expired passwords./
You also need to reset the password.
The entry MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS in the MySQL document contains the following information:
Search for SET PASSWORD
Set a new password for the root user
[html] set password for ‘root’@’localhost’=password(‘root’)
Then you can perform normal operations
How to forget the mysql root password
I. One of the methods to restore the MySQL password
If you forget the MySQL root password, you can reset it using the following methods:
1. KILL the MySQL process in the system; [html] killall-TERM mysqld 2. run the following command to start MySQL without checking its permissions: [html] safe_mysqld -- skip-grant-tables & 3. then use the empty password to log on to MySQL as the root user. [html] mysql-u root 4. modify the password of the root user. [html] mysql> update mysql. user set password = PASSWORD ('New password') where User = 'root'; mysql> flush privileges; mysql> quit
Restart MySQL to log on with the new password.
II. MySQL password restoration method 2
It is possible that your system does not have the safe_mysqld program (for example, I am using the ubuntu operating system, mysql installed with apt-get). The following method can be restored:
1. stop mysqld;
[html] /etc/init.d/mysql stop
(You may have other methods. simply stop running mysqld)
2. run the following command to start MySQL without checking its permissions;
[html] mysqld --skip-grant-tables &
3. use the empty password to log on to MySQL as the root user;
Mysql-u root
4. modify the password of the root user;
[html] mysql> update mysql.user set password=PASSWORD('newpassword') where User='root'; mysql> flush privileges; mysql> quit
Restart MySQL
[html] /etc/init.d/mysql restart
You can log on with the new password newpassword.
Mysql The server quit without updating PID file exception solution
After installing mysql, use
Java code
/Usr/local/mysql/bin/mysqld_safe &
When mysql is started, it is always in the dead state, and then suport_files is started with mysql. server start,
The prompt "mysql The server quit without updating PID file" is displayed. I found it on the internet. it turns out there is mysql.
A zombie process.
Ps-ef | grep mysql found
Php code root 4507 1 0? 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe -- user = mysql 4793 4507 0? 00:00:03/usr/local/mysql/bin/mysqld -- basedir =/usr/local/mysql .......
Kill 4793 and start again. It's normal.
Ps: kill the process under root: 4507 is not
Mysql Troubleshooting: 'Can't connect to local MySQL server through socket '/tmp/mysql. sock'
[Root @ localhost mysql] # mysqlERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock '(111) [root @ localhost mysql] # service mysqld restart it indicates that mysqld has not been started. MySQL manager or server PID file cocould not be found! [FAILED] Starting MySQL/etc/init. d/mysqld: line 159: kill: (18977)-No such process [FAILED] [root @ localhost mysql] # cd bin [root @ localhost bin] #. /mysqlERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock '(111) here we can't use/tmp/mysql. sock connects to the database. [Root @ localhost bin] # Check the cd/tmp file, and check the file for other reasons. [Root @ localhost tmp] # lsgconfd-root mapping-root mysql. sock mysql-test-ports mysql-test-ports.sem scim-panel-socket: 0-root VMwareDnD vmware-root vmware.txt [root @ localhost tmp] # cd/usr/local/mysql/[root @ localhost mysql] # pwd/usr/local/mysql [root @ localhost mysql] # chown-R root: mysql. I suddenly remembered that I didn't set the permission. I started to set the permission [root @ localhost mysql] # lltotal 36drwxr-xr-x 2 root mysql 4096 Nov 28 bindrwxr-xr-x 3 roo T mysql 4096 Nov 28 unzip dedrwxr-xr-x 2 root mysql 4096 Nov 28 infodrwxr-xr-x 3 root mysql 4096 Nov 28 libdrwxr-xr-x 2 root mysql 4096 Nov 28 libexecdrwxr-xr-x 4 root mysql 4096 Nov 28 mandrwxr-xr-x 8 root mysql 4096 Nov 28 mysql-testdrwxr-xr-x 3 root mysql 4096 Nov 28 sharedrwxr-xr-x 5 root mysql 4096 Nov 28 SQL-Runtime [root @ localhost mysql] # chown-R Mysql/var/lib/mysql [root @ localhost mysql] # cp share/mysql/my-huge.cnf/etc/my. cnf [root @ localhost mysql] # cp share/mysql. server/etc/rc. d/init. d/mysqld [root @ localhost mysql] # chmod 755/etc/rc. d/init. d/mysqld [root @ localhost mysql] # chkconfig -- add mysqld [root @ localhost mysql] # chkconfig -- level 345 mysqld on ====== error ==== === [root @ localhost mysql] # mysqladmin-u root password 'uplooking' m Ysqladmin: connect to server at 'localhost' failederror: 'Can't connect to local MySQL server through socket '/tmp/mysql. sock '(111) 'Check that mysqld is running and that the socket:'/tmp/mysql. sock 'exists! The same error [root @ localhost mysql] # bin/mysql startERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock '(111) [root @ localhost mysql] #/etc/rc. d/init. d/mysqld statusMySQL is not running, but lock exists [FAILED] Here it is said that mysql is not running, but it is still locked. At this time, I saw the following article and re-checked the permission. [root @ localhost mysql] # chown-R mysql: mysql/var/lib/mysql here, I didn't set this group when I set it. I only wrote chown-R mysql/var/lib/mysql. I ignored the group. well, it took so long. [Root @ localhost mysql] #/etc/rc. d/init. d/mysqld start from here, mysql starts normally Starting MySQL [OK] [root @ localhost mysql] #/etc/rc. d/init. d/mysqld stopShutting down MySQL [OK] [root @ localhost mysql] # [root @ localhost mysql] # mysqladmin-u root password 'uplooking' here it means that the server has not started mysqladmin: connect to server at 'localhost' failederror: 'Can't connect to local MySQL server through socket '/tmp/mysql. sock '(2) 'chec K that mysqld is running and that the socket: '/tmp/mysql. sock' exists! [Root @ localhost mysql] #/etc/rc. d/init. d/mysqld start server Starting MySQL [OK] [root @ localhost mysql] # mysqladmin-u root password 'uplooking' add root password [root @ localhost mysql] # mysqlERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO) [root @ localhost mysql] # mysql-u root-p login with the root password, test. Enter password: Welcome to the MySQL monitor. commands end with; or/g. your MySQL connection id is 3 Server version: 5.0.56-Comsenz-log SourceType 'help; 'or'/h' for help. type '/C' to clear the buffer. mysql> show databases; + -------------------- + | Database | + -------------------- + | information_schema | mysql | test | + ------------------ + 3 rows in set (0.00 sec) mysql> quitBye [root @ localhost mysql] # service mysqld restartShutting down MySQL [OK] Starting MySQL [OK] [root @ localhost mysql] #=== permission verification test = = [root @ localhost mysql] # cd/tmp [root @ localhost tmp] # mkdir test [root @ localhost tmp] # cd test [root @ localhost test] # ls [root @ localhost test] # touch 11 [root @ localhost test] # lltotal 0-rw-r -- r -- 1 root 0 Nov 28 22:37 11 [root @ localhost test] # chown-R mysql 11 [root @ localhost test] # lltotal 0-rw-r -- r -- 1 mysql root 0 Nov 28 11 [root @ localhost test] #============== ==============
BitsCN.com