安装依赖:libncurses-dev ncurses-devel
创建用户:groupadd mysql; useradd mysql -s /sbin/nologin -M -g mysql
编译安装:
tar -zxf mysql-5.5.xxx.tar.gz
cd mysql-5.5.xxx
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.xx \
-DMYSQL_DATADIR=/usr/local/mysql-5.5.xx/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.xx/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATER_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
make -j 8 && make install
ln -s /application/mysql-5.5.xx/ /application/mysql
cp /path/to/mysql-5.5.xx/support-files/my-large.cnf /etc/my.cnf
echo ‘export PATH=/application/mysql/bin:$PATH‘ >> /etc/profile
tail -l /etc/profile
source /etc/profile
echo $PATH
mkdir -p /application/mysql/data
chown -R mysql:mysql /application/mysql
chmod -R 1777 /tmp
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
<code>
Installing MySQL system tables...
151013 16:14:18 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
OK
Filling help tables...
151013 16:14:20 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name 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:
/application/mysql/bin/mysqladmin -u root password ‘new-password‘
/application/mysql/bin/mysqladmin -u root -h fangsempire-qa password ‘new-password‘
Alternatively you can run:
/application/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 /application/mysql ; /application/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /application/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems at http://bugs.mysql.com/
</code>
Access denied for user ‘root‘@‘localhost‘(using password:NO)问题解决:
pkill mysqld
lsof -i:3306
rm -rf /application/mysql/data/*
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
drop database test;
select user,host from mysql.user;
delete from mysql.user where user=‘‘;
delete from mysql.user where host=‘hostname‘;
delete from mysql.user;
grant all privileges on *.* to ‘system‘@‘localhost‘ identified by ‘password‘ with grant option;
flush privileges;
select user,host from mysql.user;
/application/mysql/bin/mysqladmin -u root password ‘password‘