Mysql5.6.40
mkdir –p /var/lib/mysql/ rpm -qa|grep mariadb // 查询出来已安装的mariadb
rpm -e --nodeps 文件名 // 卸载mariadb,文件名为上述命令查询出来的文件
yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison
5.6解压改名
chmod -R 755 mysql/
chown -R lbd.lbd mysql/
lbd用户默认已经创建
rm /etc/my.cnf
mkdir –p /var/lib/mysql/
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
vim /etc/my.cnf
[mysql]
设置mysql客户端默认字符集
default-character-set=utf8
[mysqld]
skip-name-resolve
#设置3306端口
port = 3306
设置mysql的安装目录
basedir=/usr/local/mysql
设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql/data
允许最大连接数
max_connections=200
服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
创建新表时将使用的默认存储引擎
default-storage-engine=INNODB
max_allowed_packet=16M
cp support-files/mysql.server /etc/init.d/mysqld
cd /usr/local
vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/usr/local/mysql/bin
屏蔽
#lockdir='/var/lock/subsys'
#lock_file_path="$lockdir/mysql"
chown -R lbd.lbd mysql/
service mysqld start
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
chkconfig --add mysqld #增加mysqld服务
chkconfig --list #列出所有的系统服务
chkconfig --level 35 mysqld on
#设定mysqld在等级3和5为开机运行服务
mysql –u root –p
5.6初始没密码
grant all privileges on . to 'root'@'%' identified by 'lbd123';
FLUSH PRIVILEGES;
转载于:https://blog.51cto.com/12102819/2108245