In this article, I show you how to resolve with mysql in case below:
1. When I create a user in mysql:
mysql> CREATE USER 'teppi'@'localhost' IDENTIFIED BY 'gogoale';
ERROR 2013 (HY000): Lost connection to MySQL server during queryGoogled, I know the solution for this. From of my point, it seems to be that mysql is having with mysql storage, it can not get the truly table in mysql. I will use "mysql_upgrade" to fix:
root@teppi:~# mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
This installation of MySQL is already upgraded to 5.6.19, use --force if you still need to run mysql_upgrade
root@teppi:~# mysql_upgrade --force -u root -pEnter password: Looking for 'mysql' as: mysqlLooking for 'mysqlcheck' as: mysqlcheckRunning 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure.Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure.mysql.columns_priv OKmysql.db OKmysql.event OKmysql.func OKmysql.general_log OKmysql.help_category OKmysql.help_keyword OKmysql.help_relation OKmysql.help_topic OKmysql.host OKmysql.innodb_index_stats OKmysql.innodb_table_stats OKmysql.ndb_binlog_index OKmysql.plugin OKmysql.proc OKmysql.procs_priv OKmysql.proxies_priv OKmysql.servers OKmysql.slave_master_info OKmysql.slave_relay_log_info OKmysql.slave_worker_info OKmysql.slow_log OKmysql.tables_priv OKmysql.time_zone OKmysql.time_zone_leap_second OKmysql.time_zone_name OKmysql.time_zone_transition OKmysql.time_zone_transition_type OKmysql.user OKRunning 'mysql_fix_privilege_tables'...Warning: Using a password on the command line interface can be insecure.Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure.Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' Warning: Using a password on the command line interface can be insecure....percona.checksums OKOKAfter upgraded, you can get the issues as below:
root@teppi:~# /etc/init.d/mysql status * /usr/bin/mysqladmin Ver 8.42 Distrib 5.6.19, for debian-linux-gnu on x86_64Copyright (c) 2000, 2014, 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. Server version 5.6.19-0ubuntu0.14.04.1Protocol version 10Connection Localhost via UNIX socketUNIX socket /var/run/mysqld/mysqld.sockUptime: 17 sec Threads: 1 Questions: 396 Slow queries: 0 Opens: 1685 Flush tables: 1 Open tables: 376 Queries per second avg: 23.294
root@teppi:~# mysql -u root -pEnter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)root@teppi:~# /etc/init.d/mysql status * MySQL is stopped.root@teppi:~# /etc/init.d/mysql start * Starting MySQL database server mysqld No directory, logging in with HOME=/Ok, do not worry.
root@teppi:~# ps -ef | grep mysqlmysql 29045 1 0 13:41 ? 00:00:00 /usr/sbin/mysqldmysql 31092 1 0 13:44 ? 00:00:00 /bin/sh /usr/bin/mysqld_safemysql 31523 31092 0 13:44 ? 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306root 32211 27210 0 13:45 pts/5 00:00:00 grep --color=auto mysqlroot@teppi:~# kill -9 31092 31523 29045Ok, now you can login mysql with the new user:
root@teppi:~# mysql -u teppi -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 137
Server version: 5.6.19-0ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, 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.
mysql> show databases;
Thank you for reading this article, please a comment if you are interested.
Tiến Phan - R0039
Knowledge is Endless
Sharing for Success
0 nhận xét:
Post a Comment