1、啟動(dòng)告唆,可以加參數(shù)--skip-grant-table
%mysql_home%/bin/mysqld --user=mysql
mysqld --console
mysqladmin -u root shutdown
指定啟動(dòng)時(shí)綁定的IP地址:在my.cnf中的[mysqld]字段中加入一行
bind-addr = 1.1.1.1
查看啟動(dòng)文件查找次序
mysqld --verbose --help |grep my.cnf
2邑茄、登錄
%mysql_home%/bin/mysql -u root -p -h xxx.xxx.xxx.xxx
3、停止
%mysql_home%/bin/mysqladmin -u root -p shutdown
4焊傅、
show databases;
show processlist;
select * from information_schema. USER_PRIVILEGES ;
select user,host from mysql.user;
show grants for root@'localhosts';
grant all privileges on *.* to root@'localhost' with grant option;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.28.251' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES;
--
create database jbpm;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON jbpm.* TO 'jbpm'@'%' IDENTIFIED BY '123456' with grant option;
5、 root無(wú)法登陸
mysql -u root -p
提示”Access denied for user ‘root’@’localhost’ (using password: YES)”
5.1 先想法登錄狈涮,用--skip-grant-table啟動(dòng)
%mysql_home%/bin/mysqld --user=mysql --skip-grant-tables
%mysql_home%/bin/mysql -u root 或者
%mysql_home%/bin/mysql
如果是 ERROR 1290 (HY000): Unknown error 1290
可以先執(zhí)行flush privileges;
mysql> flush privileges;
然后
%mysql_home%/bin/mysql -u root
然后
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPwd';
5.2
查看user表信息
mysql> select user,host from user;
如果沒(méi)有user@localhost只有user@%,執(zhí)行
update user set host = 'localhost' where user='root' and host = '%';
如果是密碼錯(cuò)誤狐胎,更改root@localhost密碼
update mysql.user set password = password('123456') where user='root' and host='localhost';
6、MySQL無(wú)法啟動(dòng)歌馍,問(wèn)你3306是否被占用
我這個(gè)是IP不對(duì)握巢,而不是3306被占用暈,提示能不能精確點(diǎn)松却。
7暴浦、 日志
參考:[mysqlbinlog](https://www.cnblogs.com/martinzhang/p/3454358.html)
mysql> show variables like 'log_%';
+----------------------------------------+---------------------------------------+
| Variable_name | Value |
+----------------------------------------+---------------------------------------+
| log_bin | ON | ------> ON表示已經(jīng)開(kāi)啟binlog日志
--------------
1. mysql> show master logs; //查看所有binlog日志列表
2. mysql> show master status; 查看master狀態(tài),即最后(最新)一個(gè)binlog日志的編號(hào)名稱晓锻,及其最后一個(gè)操作事件pos結(jié)束點(diǎn)(Position)值
3. mysql> flush logs; 刷新log日志歌焦,自此刻開(kāi)始產(chǎn)生一個(gè)新編號(hào)的binlog日志文件
4. mysql> reset master; //重置(清空)所有binlog日志