工作需要使用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.17 cmake -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/data 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: /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 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 /opt/mysql ; /opt/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /opt/mysql/mysql-test ; perl mysql-test-run.pl Please report any problems with the /opt/mysql/scripts/mysqlbug script!
完成后按照正常mysql的配置启动方式启动MySQL server
时间: 2024-10-05 23:36:55