Problems During MySQL Installation

Source: Internet
Author: User
Tags localhost mysql tmp file
✓ MySQL-test-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-shared-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-embedded-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-c

1 decompress MySQL [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.rpmMySQL-shared-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-embedded-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-c

1> decompress MySQL

[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.rpmMySQL-shared-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-embedded-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-client-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-devel-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-server-5.6.12-2.linux_glibc2.5.i386.rpmMySQL-shared-compat-5.6.12-2.linux_glibc2.5.i386.rpm


2> install MySQL

(1) If MySQL has been installed, the following message will appear: [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

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.

[root@localhost test]# rpm -ivh MySQL-server-5.6.12-2.linux_glibc2.5.i386.rpmPreparing...                ########################################### [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

[root@localhost test]# service mysql startStarting 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.

[root@localhost test]# ps -ef | grep mysqlroot      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.pidmysql     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.pidroot      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.pidmysql     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.pidroot      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

[root@localhost test]# service mysql startStarting MySQL SUCCESS!


4> log on to MySQL

[root@localhost test]# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 2Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


The password for the First Login is ~ /. Mysql_secret

cat .mysql_secret

After entering mysql, you must set a password. Otherwise, you cannot perform any operations. If ERROR 1862 (HY000): Your password has expired. To log in you must is prompted

Change 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

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;

killall -TERM mysqld
2. Run the following command to start MySQL without checking its permissions;

safe_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;

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;

   /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;

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;

mysql> update mysql.user set password=PASSWORD('newpassword') where User='root';mysql> flush privileges;mysql> quit


Restart MySQL

/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 www.2cto.com

/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

Www.2cto.com

Php code

Root 4507 1 0 21:40? 00:00:00/bin/sh/usr/local/mysql/bin/mysqld_safe-

-User = mysql

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] # mysql

ERROR 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 is not 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] #./mysql

ERROR 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] # ls

Gconfd-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 and started to set the permission.

[Root @ localhost mysql] # ll

Total 36

Drwxr-xr-x 2 root mysql 4096 Nov 28 bin

Drwxr-xr-x 3 root mysql 4096 Nov 28 include

Drwxr-xr-x 2 root mysql 4096 Nov 28 info

Drwxr-xr-x 3 root mysql 4096 Nov 28 lib

Drwxr-xr-x 2 root mysql 4096 Nov 28 libexec

Drwxr-xr-x 4 root mysql 4096 Nov 28 man

Drwxr-xr-x 8 root mysql 4096 Nov 28 mysql-test

Drwxr-xr-x 3 root mysql 4096 Nov 28 share

Drwxr-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'

Mysqladmin: connect to server at 'localhost' failed

Error: '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! It is the same as the above errors.

[Root @ localhost mysql] # bin/mysql start

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql. sock' (111)

[Root @ localhost mysql] #/etc/rc. d/init. d/mysqld status

MySQL 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 permissions,

[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, And 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 stop

Shutting down MySQL [OK]

[Root @ localhost mysql] #

[Root @ localhost mysql] # mysqladmin-u root password 'uplooking' indicates that the server is not started.

Mysqladmin: connect to server at 'localhost' failed

Error: 'Can't connect to local MySQL server through socket '/tmp/mysql. sock' (2 )'

Check 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 the root password

[Root @ localhost mysql] # mysql

ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: NO)

[Root @ localhost mysql] # log on to mysql-u root-p with the root password and 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 Source

Type '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> quit

Bye

[Root @ localhost mysql] # service mysqld restart

Shutting 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] # ll

Total 0

-Rw-r -- 1 root 0 Nov 28 22: 37 11

[Root @ localhost test] # chown-R mysql 11

[Root @ localhost test] # ll

Total 0

-Rw-r -- 1 mysql root 0 Nov 28 22: 37 11

[Root @ localhost test] #

======================================

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.