[CentOS] MySQL

2014. 9. 30. 12:59OS/CentOS

? http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm


# rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm

# yum -y install mysql-server

# chkconfig mysqld on

# vi /etc/my.cnf

>---------------------------------------<

[mysqld]

max_connections=2000

character-set-client-handshake=FALSE

character-set-server=utf8mb4

collation-server=utf8mb4_unicode_ci


validate_password_policy=LOW

>---------------------------------------<


# service mysqld start

# grep 'temporary password' /var/log/mysqld.log

# mysql_secure_installation


# mysqladmin -u root password '...'

# mysql -u root -p

> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.0.11' IDENTIFIED BY 'password' WITH GRANT OPTION; FLUSH PRIVILEGES;


# vi /etc/sysconfig/iptables

>---------------------------------------<

tcp 3306

>---------------------------------------<


# service iptables restart


nfs 저장소 data 폴더변경

# mount -t nfs 192.168.0.10:/mnt/data/mysql /var/lib/mysql -o context="system_u:object_r:mysqld_db_t:s0"



/var/lib/mysql



백업

# mysqldump --default-character-set=utf8mb4 --databases [name] -u root -p > file.sql

복구

# mysql -u root -p --default-character-set=utf8mb4 < file.sql



# service mysqld start

# mysqld_safe --skip-grant-tables &

# mysql -uroot

> use mysql;

> update user set authentication_string=password('password') where user='root';

> flush privileges;




-- mysql 초기화

# systemctl stop mysql

# sudo /usr/bin/mysqld_safe –skip-grant &

# mysql -u root mysql

> update user set password=password(‘변경할 비밀번호’) where user=’root’; flush privileges;

> exit;

# mysql -u root -p

# systemctl start mysql

'OS > CentOS' 카테고리의 다른 글

[CentOS] rinetd  (0) 2014.10.29
[CentOS] Sendmail  (0) 2014.10.29
[CentOS] vsftpd  (0) 2014.09.24
[CentOS] Web  (0) 2014.09.05
[CentOS] Samba  (0) 2014.09.03