Linux MySQL自己环境搭建的笔记

cd /usr/share/selinux
setenforce 0
tar -xvf MySQL-5.6.12-1.el6.x86_64.rpm-bundle.tar
rpm -qa|grep -i mysql
yum -y remove mysql-libs*
rpm -e mysql*
rpm -ivh MySQL-server-5.6.12-1.el6.x86_64.rpm
rpm -ivh MySQL-client-5.6.12-1.el6.x86_64.rpm
rpm -ivh MySQL-devel-5.6.12-1.el6.x86_64.rpm
service mysql stop
vim /etc/selinux/config
SELINUX=disabled
cp ./usr/share/doc/MySQL-server-5.6.12/my-default.cnf /etc/my.cnfvim /etc/my.cnf
 
[client]

default-character-set = gbk

port    = 3306

socket  = /mydata/mysql.sock



[mysqld]

character-set-server = gbk

datadir = /mydata/mysql

socket  = /mydata/mysql/mysql.sock

pid-file = /mydata/mysql/mysql.pid 

#key-buffer-size = 1024M

user=mysql

skip-name-resolve



#innodb_tablespace

innodb_data_home_dir = /mydata/mysql

innodb_log_group_home_dir = /mydata/mysql

innodb_data_file_path= indata01:512M:autoextend:max:512M

#innodb_log_group_home_dir = 

#innodb_data_file_path= /dev/raw/raw1:64Mnewraw

innodb_file_per_table=0



#innodb_perf_parameter

innodb_buffer_pool_size = 1024M

innodb_log_file_size = 64M

innodb_log_buffer_size =16M

innodb_flush_log_at_trx_commit = 2



sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

 
  

vim .bash_profile

 

alias pp='ps -ef|grep mysql'

export MYDATA_HOME=/mydata

   ==

mkdir /mydata
chown mysql:mysql -R /mydata
关机加盘
fdisk -l认盘
fdisk  /dev/sdb
输入m、输入n、输入PrimaryPartID,2,回车到底,输入w
start_udev 为后续RawDevice做准备
vgcreate -s 4M datavg /dev/sdb
lvcreate -L 980M -n data_lv datavg
mke2fs -j -b 4096 /dev/datavg/data_lv
mount -t ext3 /dev/datavg/data_lv /mydata
mv /var/lib/mysql /mydata
===
cat /root/.secret
mysql -uroot -pXXXXXXXXXX mysql

mysql_install_db --user=mysql --basedir=/usr --datadir=/mydata
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('111') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit;
pp
kill -9 xxxx
/usr/sbin/mysqld  --datadir=/mydata --pid-file=/mydata/mysql.pid &
mysql -uroot -p111
mysql> SET PASSWORD = PASSWORD('123');
mysql> show variables like '%char%';  
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.137.1' IDENTIFIED BY '123' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.167.137.102' IDENTIFIED BY '123' WITH GRANT OPTION;
mysql> select user,host from user;
mysql> set sql_mode='no_auto_create_user,no_engine_substitution';
 
 

你可能感兴趣的:(linux)