mysql5.5.28.tar.gz編譯安裝操作筆記 1、yum安裝依賴包 yum install wget gcc gcc-c++ make cmake ncurses-devel libtool zilib-devel -y 2、創建mysql用戶 useradd -s /sbin/nologin -M mysql 3、編譯安裝mysql cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/data/mysql/ \ -DMYSQL_USER=mysql \ -DMYSQL_TCP_PORT=3306 make && make install 4、修改mysql配置文件 cp support-files/my-medium.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld 5、初始化mysql bash scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/ 6、啟動服務 /etc/init.d/mysqld start 7、配置mysql用戶 /usr/local/mysql/bin/mysqladmin -u root password 123 /usr/local/mysql/bin/mysql -u root -p