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客户端

源码编译安装mysql-5.5.34|笔记_mysql