mysql操作記錄

來源:互聯網
上載者:User

標籤:

use mysql;
select host,user,password from user;

grant all privileges on *.* to [email protected]‘%‘ identified by "root" with grant option;
grant all privileges on *.* to [email protected]‘localhost‘ identified by "adminhongxin" with grant option;
grant all privileges on *.* to [email protected]‘127.0.0.1‘ identified by "[email protected]" with grant option;
GRANT REPLICATION SLAVE ON *.* TO ‘replication‘@‘%‘ IDENTIFIED BY ‘replication‘;

flush privileges;
show grants;

#skip-grant-tables=1

#update mysql.user user set authentication_string = password(‘[email protected]‘), password_expired = ‘N‘, password_last_changed = now() where user = ‘root‘;#mysql 5.7更改密碼

mysql -h172.168.17.67 -ufood [email protected] -e "show databases;"
mysql -h172.168.17.67 -ufood [email protected] -e "flush tables with read lock;"
mysql -h172.168.17.67 -ufood [email protected] -e "show master status;"
mysqldump -h172.168.17.67 -ufood [email protected] -e food > /opt/food-`date "+%Y-%m-%d"`.sql
mysql -h172.168.17.67 -ufood [email protected] -e "unlock tables;"

mysqldump -uroot  -proot --all-databases --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 > changhong.sql

more mei.sql #查看log files and post site

stop slave;
mysql -uroot -proot < changhong.sql
3306

CHANGE MASTER TO MASTER_HOST=‘192.168.2.3‘,MASTER_PORT=3306,MASTER_USER=‘replication‘, MASTER_PASSWORD=‘replication‘,MASTER_LOG_FILE=‘mysql-bin.000005‘,MASTER_LOG_POS=154;

start slave

show slave status\G;

===================================================================================================

[mysqld]
port = 3306
socket = /data/mysql/mysql.sock
datadir = /data/mysql/

lower_case_table_names=1

server-id = 2
log-bin=mysql-bin
binlog_format=mixed
expire_logs_days = 10

skip-external-locking
skip-name-resolve
#skip-networking #本地調用開啟,遠程tcp調用關閉

key_buffer_size = 16M
max_connections = 1000
max_allowed_packet = 16M

[mysqld_safe]

pid-file=/var/run/mysqld/mysqld.pid

log_error = /data/mysql/log/mysql-error.log
slow_query_log = 1
slow_query_log_file = /data/mysql/log/mysql-slow.log

===================================================================================================

mysql操作記錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.