你的位置:首页 > 操作系统

[操作系统]Ubuntu14


  • #卸载mysql/etc/init.d/mysqld stop &> /dev/nullkillall mysqld &> /dev/nullsudo rm -rf /mengdi/server/mysql &> /dev/nullsudo rm -rf /mengdi/server/mysql-* &> /dev/nullsudo rm -rf /mengdi/log/mysql &> /dev/nullsudo rm -rf /etc/my.cnfsudo rm -f /etc/init.d/mysqld更改环境变量
    准备工作1,创建环境统一目录sudo mkdir /mengdicd /mengdisudo mkdir serversudo mkdir -p log/mysql
    准备工作2,创建mysql用户及组groupadd mysqluseradd -g mysql -s /sbin/nologin mysql
    准备工作3,安装依赖apt-get -y updateapt-get -y autoremove mysql-serverapt-get -y install unzip build-essential libncurses5-dev libfreetype6-dev lib
    着手干
    cd /usr/src下载 mysql-5.6.21 通用二进制文件 sudo wget http://zy-res.oss-cn-hangzhou.aliyuncs.com/mysql/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz也可 sudo wget -P /usr/src http://zy-res.oss-cn-hangzhou.aliyuncs.com/mysql/mysql-5.6.21-linux-glibc2.5-x86_64.tar.gzcd /usr/srcsudo -xzf mysql-5.6.21-linux-glibc2.5-x86_64.tar.gz #解压cd /mengdi/serversudo cp -r /usr/src/mysql-5.6.21-linux-glibc2.5-x86_64 ./ #拷贝文件sudo ln -s /mengdi/server/mysql-5.6.21-linux-glibc2.5-x86_64/ /mengdi/server/mysqlsudo /mengdi/server/mysql/scripts/mysql_install_db --datadir=/mengdi/server/mysql/data/ --basedir=/mengdi/server/mysql --user=mysql #安装chown -R mysql:mysql /alidata/server/mysql/ #更改权限chown -R mysql:mysql /alidata/server/mysql/data/ #更改权限chown -R mysql:mysql /alidata/log/mysql/ #更改权限sudo cp -f /mengdi/server/mysql/support-files/mysql.server /etc/init.d/mysqld #拷贝启动文件sudo sed -i 's/^basedir=$/basedir=\/mengdi\/server\/mysql/' /etc/init.d/mysqld #替换路径sudo sed -i 's/^datadir=$/datadir=\/mengdi\/server\/mysql\/data/' /etc/init.d/mysqld #替换路径sudo vim /etc/my.cnf #启动时,未指定配置文件时,会用此文件[client]port=3306socket=/tmp/mysql.sock[mysqld]port=3306socket=/tmp/mysql.sockskip-external-lockinglog-error=/mengdi/log/mysql/error.logkey_buffer_size=16Mmax_allowed_packet=1Mtable_open_cache=64sort_buffer_size=512Knet_buffer_length=8Kread_buffer_size=256Kread_rnd_buffer_size=512Kmyisam_sort_buffer_size=8M log-bin=mysql-binbinlog_format=mixedserver-id=1 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [mysqldump]quickmax_allowed_packet=16M [mysql]no-auto-rehash [myisamchk]key_buffer_size=20Msort_buffer_size=20Mread_buffer=2Mwrite_buffer=2M [mysqlhotcopy]interactive-timeoutexpire_logs_days=5max_binlog_size=1000M
    sudo chmod 755 /etc/init.d/mysqldsudo /etc/init.d/mysqld start #{start|stop|restart|reload|force-reload|status}ps -ef |grep mysqldexport PATH=$PATH:/mengdi/server/mysql/bin