mysql 5.1編譯參數和編譯方法

一。下載:

    1.wget

    2.解壓

二。編譯:

    1.參數:

   

wKiom1RBvLKDByG4AAKY1hM0Mb0930.jpg

  ./configure \
--prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--localstatedir=/usr/local/mysql/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
 --with-plugin-PLUGIN \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static


2.make && make intall
3.複製mysql配置文件,此處爲測試,使用佔用資源最少的small.cnf
  cp my-small.cnf /etc/my.cnf

4.建立安裝文件目錄。並把文件夾的屬主遞歸改爲mysql

  mkdir -p /usr/local/mysql

  chown -R mysql.mysql /usr/local/mysql/

  5.安裝數據庫:

  /usr/local/mysql/bin/mysql_install_db --user=mysql

 6.修復警告

WARNING: The host 'ser200' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
141018 15:29:28 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
141018 15:29:28 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h ser200 password 'new-password'


VI修改hosts文件,增加mysql

[root@ser200 data]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               mysql ser150    localhost
::1             localhost6.localdomain6 localhost6

7.增加環境變量mysql路徑

[root@ser200 data]# echo "export PATH=$PATH:/usr/local/mysql/bin">> /etc/profile

[root@ser200 data]# . /etc/profile
[root@ser200 data]# echo $PATH


8.增加mysql 自啓動和init.d的服務器啓動2種方式

[root@ser200 data]# cp /home/oldboy/tools/mysql-5.1.73/support-files/mysql.server /etc/init.d/mysqld
[root@ser200 data]# chmod 700 /etc/init.d/mysqld
[root@ser200 data]# ll /etc/init.d/mysqld
-rwx------ 1 root root 12533 Oct 18 15:54 /etc/init.d/mysqld

===========================================================

[root@ser200 data]# chkconfig --add mysql

[root@ser200 data]# chkconfig --list|grep mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off


9.刪除mysql庫user表多餘的用戶

mysql> select user,host from user;    
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
|      | localhost |
| root | localhost |
|      | ser200    |
| root | ser200    |
+------+-----------+
5 rows in set (0.00 sec)

mysql> drop user ""@localhost

mysql> drop user ""@ser200

mysql>drop user root@ser200

mysql> drop user root@ser200


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章