博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql安装文档
阅读量:6096 次
发布时间:2019-06-20

本文共 2189 字,大约阅读时间需要 7 分钟。

sudo apt-get install cmake

sudo apt-get install libncurses5-dev

sudo apt-get install bison

sudo groupadd mysql

sudo useradd -s /sbin/nologin -M -g mysql mysql

tar zxvf mysql-5.5.28.tar.gz

cd mysql-5.5.28/

cmake  -DCMAKE_INSTALL_PREFIX=/data/mysql/mysql \

-DMYSQL_UNIX_ADDR=/data/mysql/log/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DENABLED_LOCAL_INFILE=1 \

-DMYSQL_DATADIR=/data/mysql/mysqldata \

-DMYSQL_TCP_PORT=3306 \

-DMYSQL_USER=mysql

make

make install

cp support-files/my-medium.cnf /etc/my.cnf

sed '/skip-external-locking/i\datadir = /data/mysql/mysqldata' -i /etc/my.cnf

if [ $installinnodb = "y" ]; then

sed -i 's:#innodb:innodb:g' /etc/my.cnf

sed -i 's:/usr/local/mysql/data:/data/mysql/mysqldata:g' /etc/my.cnf

else

sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf

fi

/data/mysql/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/data/mysql/mysql --datadir=/data/mysql/mysqldata --user=mysql

chown -R mysql /data/mysql/mysqldata

chgrp -R mysql /data/mysql/mysql.

cp support-files/mysql.server /etc/init.d/mysql

chmod 755 /etc/init.d/mysql

cat > /etc/ld.so.conf.d/mysql.conf<<EOF

/data/mysql/mysql/lib

/usr/local/lib

EOF

ldconfig

ln -s /data/mysql/mysql /usr/lib/mysql

ln -s /data/mysql/mysql/include/mysql /usr/include/mysql

if [ -d "/proc/vz" ];then

ulimit -s unlimited

fi

/etc/init.d/mysql start

ln -s /data/mysql/mysql/bin/mysql /usr/bin/mysql

ln -s /data/mysql/mysql/bin/mysqldump /usr/bin/mysqldump

ln -s /data/mysql/mysql/bin/myisamchk /usr/bin/myisamchk

ln -s /data/mysql/mysql/bin/mysqld_safe /usr/bin/mysqld_safe

/data/mysql/mysql/bin/mysqladmin -u root password $mysqlrootpwd

cat > /tmp/mysql_sec_script<<EOF

use mysql;

update user set password=password('$mysqlrootpwd') where user='root';

delete from user where not (user='root') ;

delete from user where user='root' and password=''; 

drop database test;

DROP USER ''@'%';

flush privileges;

EOF

本文转自 蔡小赵 51CTO博客,原文链接:http://blog.51cto.com/zhaopeiyan/1968406

转载地址:http://mawza.baihongyu.com/

你可能感兴趣的文章
jqgrid滚动条宽度/列显示不全问题
查看>>
在mac OS10.10下安装 cocoapods遇到的一些问题
查看>>
angularjs表达式中的HTML内容,如何不转义,直接表现为html元素
查看>>
css技巧
查看>>
Tyvj 1728 普通平衡树
查看>>
[Usaco2015 dec]Max Flow
查看>>
javascript性能优化
查看>>
多路归并排序之败者树
查看>>
java连接MySql数据库
查看>>
转:Vue keep-alive实践总结
查看>>
android studio修改新项目package名称
查看>>
深入python的set和dict
查看>>
C++ 11 lambda
查看>>
Hadoop2.5.0 搭建实录
查看>>
实验吧 recursive write up
查看>>
照猫画虎学gnuplot之折线图
查看>>
High-speed Charting Control--MFC绘制图表(折线图、饼图、柱形图)控件
查看>>
go test命令參数问题
查看>>
Hackerrank - Game Of Rotation 题解
查看>>
如何从 Vim 中访问 shell 或者运行外部命令
查看>>