mysql use 1

Forget the local administrator password
1 Turn off the database
2 Maintenance mode is activated: mysqld_safe --skip-grant-tables --skip -networking & after // reset the password using /etc/init.d/mysqld stop (restart) closed
Description: - -skip-grant-tables to skip the authorization form, - skip-networking skip remote login

3 Do mysql client connection, select user, host, authentication_string from mysql.user; to query the user
desc mysql.user; lookup table field, version 5.7 is authentication_string password field
mysql.session and mysql.sys is a system built-in user

Change Password:
flush privileges; // must execute the sentence, because --skip-grant-tables to skip the authorization at startup, so here you want to manually load the grant tables from disk to memory
Grant All ON . To root @ 'localhost' identified by 'new password'; // can also root @ 'localhost' identified by 'new password' with alter user;

mysql connector supports two remote tcp / ip, local socket, do not rely on a network (mysql -uroot -p password -s /tmp/mysql.sock)
core program mysqld, data files ibd, instances (running in the background, the guardian of running processes ), start pre-allocated memory size (memory exclusive)
examples of constitutive = mysqld + master thread + work thread (s) + pre-allocated memory

mysqld server process, where the client through tcp / ip or socket request to connect to mysqld, by an internal thread, through the connection layer -> the SQL layer (sql_mode, sql92 Standard) -> storage engine layer -> disk, memory, network
view connection thread command: show processlist; mysql command to connect the terminal uses a session is in show processlist; can be found, the default can be connected to the session 151, controlled by parameter max_connections, the session is not disconnected eight hours operation, controlled by the parameter wait_timeout
cost-based optimal execution method: cpu, memory, io, consume the least time

Guess you like

Origin www.cnblogs.com/kibana/p/12236611.html