Reset Root Password:
1. Edit the MySQL master profile my.cnf
vim/etc/my.cnf
Add a parameter under the [Mysqld] fieldskip-grant
2. Restart the database service
Service mysqld Restart
3. This allows access to the database without authorization.
Mysql-uroot
4. Modify the corresponding user password
Use MySQL;
Update user Set Password=password (' Your password ') where user= ' root ';
flush Privileges;
' Your password ' new password (using single quotes)
5. Modify /etc/my.cnf remove Skip-granT, restart MySQL service
MySQL common operation.
telnet to MySQL mysql-uroot-h12.7.0.0.1 (61.181.24.12)-p3306-p1234
Port Destination IP
Mysql-uroot-s/tmp/mysql.sock-p123
Specifies that sock is only used locally
Grant all on * * to ' root ' @ ' 192.168.0.153 ' identified by ' 123456 '
All permissions all libraries, table source IPs can use% to represent all IP
Flush Privileges
Refresh Permissions
Call system command +XX (LS..)
See which libraries show databases;
View a table for a library use Discuz (cumming); Working with libraries
Show tables; View Table
View the table's field desc table name;
View the Build Table statement Show create table table name;
Which user is currently Select users ();
Current Library Select database ();
Create library name;
CREATE TABLE T1 (' id ' int (4), ' name ' char (40));
View table show CREATE TABLE T1\g
Inserts INSERT into T1 values (1, ' Onda ') in the T1 table;
Insert only the ID insert into T1 (' id ') values (2);
Insert only the name insert into T1 (' NAME ') VALUES (' 123 ');
T1 for Table name
View table item type show columns from table name;
View database version select version ();
View MySQL status show status;
Update a row of update db1.t1 set name= ' AAA ' where id=1;
Deletes a row of delete from T1 where id=3;
Clear the table (empty the contents of the table) TRUNCATE TABLE db1.t1;
Delete tables drop table db1.t1;
Delete database drop databases db1;
View MySQL task queue show processlist;
All show full processlist;
Modify MySQL parameters show variables like ' max_connect% ';
The maximum number of connections% indicates a wildcard
Show variables like '%timeout ';
View content that matches a timeout
to change the parametersIt's written in the Linux config file/etc/my.cnf
VIM/ETC/MY.CNF Modifying configurations
Wait_timeout=8
Interactive_timeout=8, these two must be used together.
/etc/init.d/mysqld Restart Restart
Write/etc/my.cnf is written on disk (takes effect after reboot)
Show variables like '%timeout '; View has changed
Set global connect_timeout = 1000;
Parameter assignment
This is written in the cache (does not restart the change parameters)
View a table of posted posts
select * from Pre_forum_post\g;
Subject Title
Message content
Useip Source IP
Select *from pre_forum_post where subject like '%111% ' \g;
View post title for fuzzy match ' 111 '
This article is from the "you and I Walk" blog, please be sure to keep this source http://ondali.blog.51cto.com/6650368/1613934
Lamp--mysql Basic Configuration