Linux_MySql安装

时间:2024-12-22 15:34:26

1、卸载原始mysql-lib

sudo rpm -e --nodeps mysql-libs-xx

2、yum安装mysql-server

sudo yum -y install mysql -server
ps:注意联网状态,和yum源/etc/yum.repos.d/xxx
更新软件 sudo yum update xxx

3、配置开机启动项

sudo chkconfig --list | grep mysql
sudo service mysqld start
sudo chkconfig mysqld on

4、配置

设置密码:
  mysqladmin -u root password 'new-password'
进入mysql:
  mysql -uroot -p
设置mysql连接权限
  show databases;
  use mysql;
  grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
  select User,Host from user;
  delete from user where Host !='%';
  flush privileges;
  quit;
  sudo service mysqld restart