2019独角兽企业重金招聘Python工程师标准>>>
1、gcc
yum install gcc gcc-c++ ncurses-devel perl
2、cmake安装
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap ; make ; make install
cd ~
3、设置MySQL用户和组
groupadd mysql
useradd -r -g mysql mysql
4、下载mysql源码包
cd /usr/local/src
wget http://www.kakapart.com/files/mysql-5.6.16.tar.gz
tar -zxv -f mysql-5.6.16.tar.gz
cd mysql-5.6.16
5、cmake
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1
6、安装
make clean
rm CMakeCache.txt
make
make install
7、修改mysql目录所有者和组
#修改mysql安装目录
cd /usr/local/mysql
chown -R mysql:mysql .
#修改mysql数据库文件目录
cd /home/data/mysql/data
chown -R mysql:mysql .
8、初始化mysql数据库
- cd /usr/local/mysql
- scripts/mysql_install_db --user=mysql --datadir=/home/data/mysql/data
9、配置my.cnf
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
my.cnf,主要指定datadir和utf8
[mysqld]
datadir=/home/data/mysql/data
#socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
#old_passwords=1# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
character_set_server=utf8#[mysqld_safe]
#log-error=/var/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid
10、复制mysql服务启动脚本及加入PATH路径
cp support-files/mysql.server /etc/init.d/mysqld
vim /etc/profile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
export PATHsource /etc/profile
11、启动
service mysqld start
chkconfig --level 35 mysqld on
12、设置访问密码
mysqladmin -u root password '123456'
13、连接数据库
mysql -uroot -p123456
use mysql
14、授权远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.9.235' IDENTIFIED BY '123456' WITH GRANT OPTION;FLUSH PRIVILEGES;