时间:2021-07-01 10:21:17 帮助过:2人阅读
MySQL安装
依赖安装:
gcc make cmake ncurses-devel libxml2-devel libtool-ltdl-devel gcc-c++ autoconf auromake bison zlib-devel
boost安装:
./bootstrap.sh ./b2 stage threading=multi link=shared ./b2 install threading=multi link=shared
创建mysql用户:
groupadd mysql useradd -r -s /sbin/nologin -g mysql mysql
编译安装:
tar -zxf mysql-x-x-x.tar.gz -C /usr/src/ cmake . -DENABLE_DOWNLOADS=1 make && make install
更改/usr/local/mysql目录的属主和属组:
chown -R mysql:mysql /usr/local/mysql
初始化:
./bin/mysql_instal_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
复制mysql主配置文件到/etc/:
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
复制mysql启动脚本及加入PATH路经:
cp /usr/local/mysql/support-file/mysql.server /etc/init.d/mysqld
vim /etc/progile
PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH export PATH
启动服务:
service mysqld start chkconfig --level 35 mysqld on
检查是否启动:
ps -aux | grep mysql
修改root密码:
mysqladmin -u root password ‘123456‘
注:也可运行安全设置脚本,修改MySQL用户root的密码,同时可禁止root远程连接,移除test数据库和匿名用户:
/usr/local/mysql/bin/mysql_secure_installation
mysql安装
标签:mysql