標籤:linux mysql 使用者組
工作需要使用MySQL,在linux中用yum安裝,安裝路徑不可控,不能對它進行定製,為了更好的管理MySQL Sever,採用源碼安裝。
MySQL 5.5.17安裝需要使用cmake編譯工具,可以使用yum 來安裝cmake
安裝MySQL DB
建立相關使用者組及使用者
groupadd mysql useradd –g mysql mysql
在存放MySQL源碼包路徑解壓並且安裝(手動建立相應安裝目錄)
#mkdir /opt/mysql#chown -R mysql:mysql /opt/mysql#gunzip mysql-5.5.17.tar.gz#tar xvf mysql-5.5.17.tar#cd mysql-5.5.17cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 -DMYSQL_DATADIR=/opt/mysql/data -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all#make#make install 初始化DB# sh scripts/mysql_install_db --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/dataInstalling MySQL system tables...OKFilling help tables...OK To start mysqld at boot time you have to copysupport-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: /opt/mysql/bin/mysqladmin -u root password ‘new-password‘/opt/mysql/bin/mysqladmin -u root -h mysql password ‘new-password‘ Alternatively you can run:/opt/mysql/bin/mysql_secure_installation which will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with:cd /opt/mysql ; /opt/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.plcd /opt/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/mysql/scripts/mysqlbug script!
完成後按照正常mysql的配置啟動方式啟動MySQL server
本文出自 “DBA的天空” 部落格,請務必保留此出處http://kevinora.blog.51cto.com/9406404/1665710
MySQL 5.5.17 源碼安裝