mysql安装文档
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql安装文档相关的知识,希望对你有一定的参考价值。
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
以上是关于mysql安装文档的主要内容,如果未能解决你的问题,请参考以下文章