源码安装mysql

 

1. 获取mysql源码安装包
mysql-5.1.49.tar.gz

2. 解压
tar zxvf mysql-5.1.49.tar.gz

3. 配置makefill
cd mysql-5.1.49
./configure --prefix=/home/work/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,utf8,ascii,big5,latin1,binary --localstatedir=/home/work/local/mysql --with-plugins=all --with-pthread --enable-static --enable-thread-safe-client --enable-assembler --without-ndb-debug --with-unix-socket-path=/home/work/local/mysql/tmp/mysql.sock --with-mysqld-user=work

4. make

5. make install

6. cd /home/work/local/mysql
mkdir -p /home/work/local/mysql/{tmp,log,data,etc}

7. /home/work/local/mysql/bin/mysql_install_db --datadir=/home/work/local/mysql/data

8. vim my.cnf 
端口改为8888

11. 启动mysql 
/home/work/local/mysql/bin/mysqld_safe &

12. 初始化密码 
/home/work/local/mysql/bin/mysqladmin -u root password 'password' 
/home/work/local/mysql/bin/mysqladmin -u root password 'password' -h 127.0.0.1

13. 远程访问授权 
cd /home/work/local/mysql/bin/ 
./mysql -u root -p password

14 SQL执行 
mysql> use mysql; 
mysql> DELETE FROM user WHERE User='root' and Host='$hostname'; 
mysql> DELETE FROM user WHERE User='' and Host='localhost'; 
mysql> DELETE FROM user WHERE User='' and Host='$hostname'; 
mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' WITH GRANT OPTION; 
mysql> FLUSH PRIVILEGES;

 

你可能感兴趣的:(mysql)