Useradd mysql-s/sbin/nologin
cat/etc/passwd | grep MySQL
Cat/etc/group | grep MySQL
SOURCE Directory
Cd/usr/src/mysq
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/var/lib/mysql-dsysconfdir=/etc-dwith_myisam_storage_ Engine=1-dwith_innobase_storage_engine=1-dwith_archive_storage_engine=1-dwith_blackhole_storage_engine=1-dwith _federated_storage_engine=1-dwith_partition_storage_engine=1-dmysql_unix_addr=/tmp/mysqld.sock-denabled_local_ Infile=1-dextra_charsets=all-dmysql_user=mysql-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dextra _charsets=all-dmysql_tcp_port=3306
./cmake.sh Gmake Make Install
Mkdir/var/lib/mysql
Chown Mysql.mysql
ll
Ls
:(Configure.cmake)
Cd/usr/local/mysql
CD support-files/
Mysql.server
CP Mysql.server/etc/init.d/mysql
CP MY-DEFAULT.CNF/ETC/MY.CNF
VI my.cnf
Basedir=/usr/local/mysql
Datadir=/var/lib/mysql
Port= 3306
Socket=/temp/mysqld.sock
cd/usr/local/mysql/scripts/
./mysql_install_db--help
./mysql_install_db--basedir=/usr/local/msql/--datadir=/var/lib/mysql--no-defaults--usre=mysql
Cd/var/lib/mysql
Service MySQL Start
Ps-ef |grep MySQL
cd/usr/local/mysql/
CD bin/
./mysql
Cd
VI. bash_profile
Path= $PATH/bin:/usr/local/mysql/bin
SOURCE ~/.bash_profile
Add Log recovery function
Vi/etc/my.cnf
In order to recover the database through the log, in your my.cnf file should have the following definition, Log-bin=mysql-bin, this is necessary. Binlog-do-db=db_test, this is to specify which databases require logs, and if there are multiple databases on each line, If not specified, the default is all databases.
[Mysqld]
Log-bin=mysql-bin
Binlog-do-db=db_test
Binlog-do-db=db_test2
Expire_logs_day=3 sets the number of days that the log expires, after a specified number of days, is automatically deleted
--------------------------------------
Reset Master (clears all binary log files)
Purge master logs to ' bintest.000006 ';(delete binary log files before bintest.000006)
Purge master logs before ' 2007-08-10 04:07:00 ' (delete the log before the date)
SHOW BINLOG EVENTS G
1. Restore all databases:
(1) MySQL command line: Mysql>source f:\all.sql
(2) System command line: mysql-uroot-p123456 <f:\all.sql
MySQL Related full notes