Problems During MySQL Installation

Source: Internet
Author: User
Tags localhost mysql tmp file

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  

 

Uninstall MySQL with command rpm-e MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpm-nodeps first
[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) The first time MySQL server is started, the solution of exception information appears
[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  

 

Use kill-9 2171 to kill and then 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 for the entry MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS In the MySQL document. Find the following information and set password to SET a new PASSWORD for the root user.
[html] set password for ‘root’@’localhost’=password(‘root’)  

 

After that, you can perform normal operations to forget the mysql root Password solution 1. 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 recovery 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 to stop running mysqld.) 2. Run the following command to start MySQL without checking the 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 use The new password newpassword to log on to mysql. The server quit without updating PID file has an exception. After mysql is installed, use the Java code/usr/local/mysql/bin/mysqld_safe & to start mysql, always in the dead state, and then use mysql to suport_files. server start, prompting mysql The server quit without updating PID file. I found it on the Internet and said it was a zombie process started by mysql. 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. Ps: kill the process under the root server. 4507 is the correct solution for Mysql errors: '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] #============== ==============

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.