©
本文档使用 PHP中文网手册 发布
采用二进制方式免编译安装MySQL,这种方法和yum/rpm包安装方式类似.
适合各类MySQL产品系列,不需要复杂的编译设置和编译时间等待,直接解压下载的软件包,初始化即可完成MySQL的安装和启动.
useradd mysql -s /sbin/nologin
tar xf mysql-5.5.45-linux2.6-x86_64.tar.gz && cp mysql-5.5.45-linux2.6-x86_64 /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql/data
cd /usr/local/mysql/scripts && ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/ usr/local/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql chkconfig --add mysqld service mysqld start
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
/usr/local/mysql/bin/mysqladmin -uroot password 'aaaaaa' ;