下载mysql的安装包,注意系统位数。
cd /usr/local/src
wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-i686-glibc23.tar.gz
解压安装包:
tar zxvf mysql-5.1.73-linux-i686-glibc23.tar.gz
初始化:
useradd -s /sbin/nologin -M mysql
mv mysql-5.1.73-linux-i686-glibc23 /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql /data/mysql
/usr/local/mysql
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
echo $? 或者 出现ok
拷贝配置文件和启动脚本
cd /usr/local/mysql/support-files
cp my-large.cnf /etc/my.cnf
vim /etc/my.cnf //编辑或者修改,注释以下。
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
启动文件:
cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysqld
vim /etc/init.d/mysqld //编辑或者修改
basedir=/usr/local/mysql
datadir=/data/mysql
chkconfig --add mysqld
chkconfig mysqld on
/etc/init.d/mysqld start
查看进程:
ps aux |grep mysqld
netstat -nlp |grep mysqld
报错:-bash:mysql:command not found
ln -s /usr/local/mysql/bin/mysql /usr/bin
创建用户mysqladmin -uroot password 12345 用户登录mysql -uroot -p12345