Hi 你們好,我是鍾義林 咱們來安裝mysql,下面是筆記的原稿。下面我開始吧node
首先下載cmakewget http://www.cmake.org/files/v2.8/cmake-2.8.12.1.tar.gzmysql
#下載Curseswget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gzsql
yum install bison yum install ncurses-devel ncurses openssl-develshell
而後下載mysqlwget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.34.tar.gz 鏈接失效了,可能你須要去mysql的官網登入一下bootstrap
tar zxvf cmake-2.8.12.1 && tar zxvf mysql-5.5.34tar.gzide
cd cmake-2.8.12.1 ./bootstrap && gmake && make && make installthis
tar zxvf mysql-5.5.34.tar.gzspa
cd msyql-5.5.34 orm
cmake . \server
-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客戶端