CentOS安装MySQL步骤教程
程序员文章站
2022-12-02 22:03:03
下载mysql的repo源
wget
安装mysql57-community-release-el7-11.noarch.rpm包
sudo rpm -ivh m...
下载mysql的repo源
wget
安装mysql57-community-release-el7-11.noarch.rpm包
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm 安装这个包后,会获得两个mysql的yum repo源: /etc/yum.repos.d/mysql-community.repo, /etc/yum.repos.d/mysql-community-source.repo。
安装mysql
sudo yum install mysql-server
重置mysql密码
重新初始化mysql数据库用的表 mysqld --initialize --user=mysql sudo chown -R root:root /var/lib/mysql mysql -u root -p 这行中会有密码 grep 'temporary password' /var/log/mysqld.log 设置密码的验证策略和验证长度 set global validate_password_policy=0; set global validate_password_length=1; ALTER USER USER() IDENTIFIED BY 'root'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION; FLUSH PRIVILEGES; [mysqld] port=3306 # innodb_buffer_pool_size = 128M # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid update user set authentication_string = password('admin') where user = 'root';
下一篇: 本田汽车计划在2020年推出无人驾驶汽车