源碼編譯安裝mysql-5.5.34|筆記


Hi 大家好,我是鍾義林 我們來安裝mysql,下面是筆記的原稿。下面我開始吧


首先下載cmakewget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gz

   #下載Curseswget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

   yum install bison  yum install ncurses-devel    ncurses  openssl-devel

然後下載mysqlwget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.34.tar.gz   連接失效了,可能你需要去mysql的官網登入一下


tar  zxvf cmake-2.8.12.1 && tar zxvf mysql-5.5.34tar.gz


cd cmake-2.8.12.1 ./bootstrap && gmake && make && make install


tar zxvf mysql-5.5.34.tar.gz


cd msyql-5.5.34


cmake . \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \

-DINSTALL_DATADIR=/usr/local/mysql/data/ \

-DSYSCONFDIR=/usr/local/mysql/etc  \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=all \

-DWITH_SSL=system \

-DWITH_EMBEDDED_SERVER=1  \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DMYSQL_USER=mysql \

-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock



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

#cp support-files/my-default.cnf /usr/local/mysql/etc/my.cnf (版本問題 可能沒有這些配置文件)

#[root@Nutcracker support-files]# pwd

/usr/local/mysql/support-files

[root@Nutcracker support-files]# ls

binary-configure   my-huge.cnf             mysqld_multi.server

config.huge.ini    my-innodb-heavy-4G.cnf  mysql-log-rotate

config.medium.ini  my-large.cnf            mysql.server

config.small.ini   my-medium.cnf           ndb-config-2-node.ini

magic              my-small.cnf            solaris


#這裏說明一下,你可以吧你需要的.cnf文件cp到 /etc下 改名沒my.conf

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

shell> groupadd mysql

shell> useradd -r -g mysql mysql

shell> cd /usr/local/mysql

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> scripts/mysql_install_db --user=mysql

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

如果出現下列警告,請暫時忽略

ARNING: The host 'Nutcracker' 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...

OK

Filling help tables...

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:


./bin/mysqladmin -u root password 'new-password'

./bin/mysqladmin -u root -h Nutcracker password 'new-password'


Alternatively you can run:

./bin/mysql_secure_installation


which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:

cd . ; ./bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl

cd ./mysql-test ; perl mysql-test-run.pl


Please report any problems with the ./bin/mysqlbug script!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

shell> chown -R root .

shell> chown -R mysql data

shell> bin/mysqld_safe --user=mysql &


cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld



/usr/local/mysql/scripts/mysql_install_db \

--defaults-extra-file=/etc/my.cnf \

--basedir=/usr/local/mysql \

--datadir=/usr/local/mysql \

--user=mysql


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

請忽略警告信息,成功

WARNING: The host 'Nutcracker' 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...

OK

Filling help tables...

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 Nutcracker password 'new-password'


Alternatively you can run:

/usr/local/mysql/bin/mysql_secure_installation


which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.


See the manual for more instructions.


You can start the MySQL daemon with:

cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &


You can test the MySQL daemon with mysql-test-run.pl

cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl


Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



/usr/local/mysql/bin/mysqladmin -u root password 'newpassword' #mysqDB root的密碼


cp support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld


/etc/init.d/mysqld start (啓動mysql)


yum install mysql 安裝連接mysql客戶端

wKiom1MxM4jTlsJLAAOmMxziovE048.jpg



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