大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
二进制安装: [root@lufengcentos ~]# mkdir /home/lufeng/tools -p [root@lufengcentos ~]# cd /home/lufeng/tools [root@lufengcentos tools]# rz [root@lufengcentos tools]# tar xf MySQL-5.5.49-linux2.6-x86_64.tar.gz [root@lufengcentos tools]# mkdir -p /application/mysql-5.5.49 [root@lufengcentos tools]# mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49 创建mysql用户|组 [root@lufengcentos tools]# groupadd mysql [root@lufengcentos tools]# useradd mysql -g mysql -s /sbin/nologin -M 初始化配置文件 [root@lufengcentos tools]# ln -s /application/mysql-5.5.49/ /application/mysql [root@lufengcentos tools]# cd /application/mysql [root@lufengcentos mysql]# cp support-files/my-small.cnf /etc/my.cnf 初始化数据库文件 [root@lufengcentos mysql]# mkdir -p /application/mysql/data [root@lufengcentos mysql]# chown -R mysql.mysql /application/mysql/ [root@lufengcentos mysql]# /application/mysql/scripts/mysql_install_db --basedir=/application//mysql --datadir=/application/mysql/data --user=mysql 配置并启动mysql [root@lufengcentos mysql]# cp support-files/mysql.server /etc/init.d/mysqld [root@lufengcentos mysql]# chmod +x /etc/init.d/mysqld root@lufengcentos mysql]# sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld [root@lufengcentos mysql]# /etc/init.d/mysqld start Starting MySQL... SUCCESS! [root@lufengcentos mysql]# netstat -lntup|grep mysql tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2951/mysqld 配置全局使用路径 [root@Mysql-server ~]# echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile [root@Mysql-server ~]# tail -1 /etc/profile export PATH=/application/mysql/bin:$PATH [root@Mysql-server ~]# echo $PATH /application/mysql/bin:/applicaion/mysql/bin:/applicaion/mysql/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin 安全配置: [root@Mysql-server ~]# mysqladmin -u root password '199429' [root@Mysql-server ~]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@Mysql-server ~]# mysql -uroot -p 删除多余用户: +------+-----------+ | user | host | +------+-----------+ | root | 127.0.0.1 | | root | localhost | +------+-----------+