mysql 编译安装

时间:2022-01-13 12:23:46
mysql 编译安装方式
 
```cd /home/oldboy/tools```                创建 目录        
 if not have   then     mkdir -p /home/oldboy/tools
```rz -y  choose cmake-2.8.8.tar.gz```
```tar xf cmake-2.8.8.tar.gz```
```cd cmake-2.8.8.tar```
```./configuer```
 
                                                                               
     yum install gcc-c++ 
```groupadd mysql```
```useradd mysql -s /sbin/nologin -M -g mysql```
```gmake
```gmake install```
 
接下来下载依赖包:  ```yum install ncurses-devel -y```
{yum install libiao-devel -y}
 
     cd ..
解压:   ```tar xf mysql-5.5.32.tar.gz```
             cd  mysql-5.5.32
接下来创建目录  ```mkdir -p  /application/mysql```
```cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql  
-DMYSQL_DATADIR=/application/mysql/data```
```cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf```
                  if -bash: cd: /my.cnf:Not a directory
  cd /etc
  mkdir my.cnf
```echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile   
```tail -1 /etc/profile
source /etc/profile
echo $PATH``` 
```ll /application/mysql/data```
 
授权:
```chown -R mysql.mysql /application/mysql/data``` 
```chmod -R 1777 /tmp/```
```cd /application/mysql/scripts/```
```./mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/datall
/ --user=mysql```
                              (出现两个ok ,则为成功)
 
```cd /home/oldboy/tools/mysql-5.5.32```
```/bin/cp support-files/mysql.server /etc/init.d/mysqld```
```chmod +x /etc/init.d/mysqld```
```/etc/init.d/mysqld start```
 
netstat -lntup|grep 3306
 
启动:  mysql