MYSQL
1. 查看mysql:rpm -qa mysql
2. yum安装mysql:yum install mysql mysql-server mysql-devel -y
3. yum卸载mysql:yum remove mysql*
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql55/ \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_BIG_TABLES=1 \
-DWITH_DEBUG=0
对于MySQL的介绍文章并不多,当然你有兴趣,可以看看mysql主从同步和mysql读写分离
http://blog.csdn.net/wanglei_storage/article/details/48808777
http://blog.csdn.net/wanglei_storage/article/details/48791361
安装简介
用户名:mysql
安装目录:/usr/local/mysql
数据库目录:/usr/local/mysql/data
安装前步骤
一、添加用户
groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
二、yum安装依赖包
yum -y install gcc* ncurses-devel cmake bison
三、解包
tar zxf mysql-5.6.13.tar.gz -C /usr/src
cd /usr/src/mysql-5.6.13
四、创建数据目录
mkdir -p /usr/local/mysql/data
五、cmake配置
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DWITH_SSL=yes -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGING=1 -DWITH_INNOBASE_STORAGE_ENGING=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
六、编译及安装
make && make install
==============================创建启动方式-并初始化===================
七、拷贝配置文件
cp support-files/my-default.cnf /usr/local/mysql/my.cnf
八、初始化数据库
cd /usr/local/mysql/scripts/
./mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/ --basedir=/usr/local/mysql/
九、设置链接【此处可无】
ln -s /usr/local/mysql/bin/* /usr/local/bin/
ln -s /usr/local/mysql/include/mysql/* /usr/include/
ln -s /usr/local/mysql/lib/* /usr/lib/
十、设置权限
chown -R mysql:mysql /usr/local/mysql/
十一、修改my.cnf配置【/usr/local/mysql/my.cnf】
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
log-error = /usr/local/mysql/mysql_error.log
pid-file = /usr/local/mysql/mysql.pid
user = mysql
tmpdir = /tmp
十二、复制启动进程
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
rm -rf /etc/my.cnf
ln -s /usr/local/mysql/my.cnf /etc
十三、启动
/etc/init.d/mysqld start
例:如果sock文件丢失指定文件1,也可以链接2
进入mysql:/usr/local/mysql/bin/mysql
(1) mysql -S /var/lib/mysql/mysql.sock -u root
(2) ln -s /var/lib/mysql/mysql.sock /usr/local/mysql/mysql.sock
网友评论