yogjun / myblog

0 stars 0 forks source link

mysql安装 #29

Closed yogjun closed 2 years ago

yogjun commented 4 years ago

1.检查是否已经安装过mysql rpm -qa | grep mysql 有就删除 rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.x86_64 2.下载 http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz 3.安装 tar xzvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql chown -R mysql:mysql /usr/local/mysql chmod -R 755 /usr/local/mysql cd /usr/local/mysql/bin ./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql 记住最后的密码 编辑配置文件my.cnf [mysqld] datadir=/usr/local/mysql/data port = 3306 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES symbolic-links=0 max_connections=400 innodb_file_per_table=1

表名大小写不明感,敏感为

lower_case_table_names=1

/usr/local/mysql/support-files/mysql.server start ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql service mysql restart mysql -u root -p set password for root@localhost = password('yourpass'); use mysql; update user set user.Host='%' where user.User='root'; flush privileges;

设置开机启动 1、将服务文件拷贝到init.d下,并重命名为mysql [root@localhost /]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 2、赋予可执行权限 [root@localhost /]# chmod +x /etc/init.d/mysqld 3、添加服务 [root@localhost /]# chkconfig --add mysqld 4、显示服务列表 [root@localhost /]# chkconfig --list 参考:https://www.jianshu.com/p/276d59cbc529