MYSQL 二进制安装+XFS

1. 准备分区
yum install  xfsprogs
[root@ycdatadbsupport yum.repos.d]# mkfs.xfs -f -i attr=2 -l lazy-count=1,sectsize=4096 -b size=4096 -d sectsize=4096 -L data /dev/sdb
meta-data=/dev/sdb               isize=256    agcount=4, agsize=1966080 blks
         =                       sectsz=4096  attr=2
data     =                       bsize=4096   blocks=7864320, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=3840, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@ycdatadbsupport yum.repos.d]# mkdir /data
[root@ycdatadbsupport yum.repos.d]# mount -o rw,noatime,nodiratime,noikeep,nobarrier,allocsize=100M,attr2,largeio,inode64,swalloc /dev/sdb /data
[root@ycdatadbsupport yum.repos.d]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       36G  4.0G   30G  12% /
tmpfs                 2.0G  264K  2.0G   1% /dev/shm
/dev/sda1             485M   59M  401M  13% /boot
/dev/sr0              3.5G  3.5G     0 100% /media/OL6.3 x86_64 Disc 1 20120626
/dev/sr0              3.5G  3.5G     0 100% /mnt
/dev/sdb               30G   33M   30G   1% /data
[root@ycdatadbsupport yum.repos.d]# vi /etc/fstab 




#
# /etc/fstab
# Created by anaconda on Fri May 23 22:30:35 2014
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1
UUID=181e768c-89a3-4e65-b576-4f9ae746f642 /boot                   ext4    defaults        1 2
/dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/sdb               /data                   xfs     rw,noatime,nodiratime,noikeep,nobarrier,allocsize=100M,attr2,largeio,inode64,swalloc    0 0


2. 准备目录:
[root@ycdatadbsupport yum.repos.d]# mkdir -p /data/mysql/mysql_3306/data
[root@ycdatadbsupport yum.repos.d]# mkdir -p /data/mysql/mysql_3306/tmp
[root@ycdatadbsupport yum.repos.d]# mkdir -p /data/mysql/mysql_3306/logs
[root@ycdatadbsupport yum.repos.d]# chown -R root:mysql /data
[root@ycdatadbsupport yum.repos.d]# chown -R mysql:mysql /data
[root@ycdatadbsupport yum.repos.d]# chmod -R 775 /data


3. 解压MYSQL软件
tar -xzvf mysql-5.5.37-linux2.6-x86_64.tar.gz 


4. 做好软链接
[root@ycdatadbsupport opt]# ln -s /opt/mysql-5.5.37-linux2.6-x86_64 /usr/local/mysql


5. 准备初始化文件:
vi /etc/my.cnf


6. 初始化DB
[root@ycdatadbsupport mysql5]# scripts/mysql_install_db --defaults-file=/etc/my.cnf --user=mysql
Installing MySQL system tables...
140612 13:51:56 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set
OK
Filling help tables...
140612 13:51:56 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set
OK


To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:


/usr/local/mysql5//bin/mysqladmin -u root password ‘new-password‘
/usr/local/mysql5//bin/mysqladmin -u root -h ycdatadbsupport.localdomain password ‘new-password‘


Alternatively you can run:
/usr/local/mysql5//bin/mysql_secure_installation


which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:
cd /usr/local/mysql5/ ; /usr/local/mysql5//bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql5//mysql-test ; perl mysql-test-run.pl


Please report any problems at http://bugs.mysql.com/


7. 启动数据库
[root@ycdatadbsupport local]# mysqld_safe --defaults-file=/etc/my.cnf &
[1] 7666
[root@ycdatadbsupport local]# 140612 14:46:33 mysqld_safe Logging to ‘/data/mysql/mysql_3306/data/error.log‘.
140612 14:46:33 mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql_3306/data




8. 连接MSYQL, 修改ROOT密码。第一次登录是不需要密码的。 这样MYSQL就安装成功了。 
[root@ycdatadbsupport local]# mysql -uroot -p -S /tmp/mysql.sock 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.37-log MySQL Community Server (GPL)


Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


(testing)root@ycdatadbsupport [(none)]> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "vipshop";
Query OK, 0 rows affected (0.00 sec)




(testing)root@ycdatadbsupport [(none)]> use mysql;
Database changed
(testing)root@ycdatadbsupport [mysql]> update user set password = password(‘vipshop‘) where user=‘root‘;
Query OK, 4 rows affected (0.01 sec)
Rows matched: 5  Changed: 4  Warnings: 0


(testing)root@ycdatadbsupport [mysql]> commit;
Query OK, 0 rows affected (0.00 sec)


(testing)root@ycdatadbsupport [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)


(testing)root@ycdatadbsupport [mysql]> exit
Bye
[root@ycdatadbsupport local]# mysql -uroot -p -S /tmp/mysql.sock 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.37-log MySQL Community Server (GPL)


Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


(testing)root@ycdatadbsupport [(none)]> 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。