Summary of MySQL login problems I want to practice MySQL in my own small book. As a result, I had a problem logging in. After half an hour, I finally got it done, I also summarized these common problems and shared them with you. The author's system is OpenSuSE, and other systems have similar solutions for your reference. First, log on to MySQL and prompt ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql. sock '(2). After ps, I feel that mysqld is started. [plain] atom @ openSuSE: ~> Mysql-u root-h localhost-p Enter password: www.2cto.com ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql. sock '(2) atom @ openSuSE: ~> Ps aux | grep mysql atom 1842 0.0 1.0 265564 41296? Sl/usr/sbin/mysqld -- defaults-file =/home/atom /. local/share/akonadi // mysql. conf -- datadir =/home/atom /. local/share/akonadi/db_data/-- socket =/home/atom /. local/share/akonadi/socket-openSuSE.site/mysql. socket atom 2788 0.0 0.0 8276 pts/0 S + grep -- color = auto mysql
However, check the status of mysqld and find that Active: inactive (dead )... [Plain] atom @ openSuSE: ~> /Etc/init. d/mysql status redirecting to systemctl mysql. service-LSB: Start the MySQL database server Loaded: loaded (/etc/init. d/mysql) Active: inactive (dead) CGroup: name = systemd:/system/mysql. then start mysql again and observe the mysql status.
[Plain] atom @ openSuSE: ~> Sudo/etc/init. d/mysql restart redirecting to systemctl www.2cto.com atom @ openSuSE: ~> Ps aux | grep mysql atom 1842 0.0 1.0 265564 41296? Sl/usr/sbin/mysqld -- defaults-file =/home/atom /. local/share/akonadi // mysql. conf -- datadir =/home/atom /. local/share/akonadi/db_data/-- socket =/home/atom /. local/share/akonadi/socket-openSuSE.site/mysql. socket root 22000 0.0 0.0 11536 1644? S/bin/sh/usr/bin/mysqld_safe -- mysqld = mysqld -- user = mysql -- pid-file =/var/run/mysql/mysqld. pid -- socket =/var/run/mysql. sock -- datadir =/var/lib/mysql 22322 0.2 1.0 721584? Sl/usr/sbin/mysqld -- basedir =/usr -- datadir =/var/lib/mysql -- plugin-dir =/usr/lib64/mysql/plugin -- user = mysql -- log-error =/var/log/mysql/mysqld. log -- pid-file =/var/run/mysql/mysqld. pid -- socket =/var/run/mysql. sock -- port = 3306 atom 22359 0.0 0.0 8276 pts/0 S + grep -- color = auto mysql atom @ openSuSE: ~> /Etc/init. d/mysql status redirecting to systemctl mysql. service-LSB: Start the MySQL database server Loaded: loaded (/etc/init. d/mysql) www.2cto.com Active: active (running) since Mon, 18 Jun 2012 09:32:43 + 0800; 3 min 32 s ago Process: 21865 ExecStart =/etc/init. d/mysql start (code = exited, status = 0/SUCCESS) CGroup: name = systemd:/system/mysql. service restart 22000/bin/sh/usr/bin/mysqld_safe -- mysqld = mysqld -- user = mysql -- pid-file =/var/run/mysql/mysqld. pid -- socket =... export 22322/usr/sbin/mysqld -- basedir =/usr -- datadir =/var/lib/mysql -- plugin-dir =/usr/lib64/mysql/plugin -- user = mys. ..
Now the system is working properly. The ERROR code "ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)" is returned when you try to log on again ). Find a solution on the Internet for your reference. First, disable the mysqld service, and then execute the following two commands. You can finally go in and change the password first ~ [Plain] atom @ openSuSE: ~> Sudo/etc/init. d/mysql stop root's password: www.2cto.com redirecting to systemctl atom @ openSuSE: ~> Sudo mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & [1] 22638 atom @ openSuSE: ~> 120618 09:40:32 mysqld_safe Logging to '/var/log/mysql/mysqld. log'. 120618 09:40:32 mysqld_safe Starting mysqld daemon with databases from/var/lib/mysql atom @ openSuSE: ~> Mysql-u root mysql [SQL] mysql> UPDATE user SET Password = PASSWORD ('xxxx') where USER = 'root'; mysql> FLUSH PRIVILEGES; mysql> quit: replace xxxx in PASSWORD ('xxxx') with your own PASSWORD. Restart once and use the new password.
Author nevasun