yum 安装 mysql

  1. yum --releasever=6 list installed mysql*      查看以安装的mysql
  2. yum --releasever=6 list mysql*    查看可安装的mysql
  3. yum --releasever=6 install mysql-sever
  4. yum --releasever=6 linstall mysql-devel
  5. mysql配置文件/etc/my.cnf中加入character-set-server=utf8
  6. 启动MySQL :service mysqld start
  7. mysqladmin -u root password 1234  设置root密码
  8. 远程访问:mysql增加权限:mysql库中的user表新增一条记录host为“%”,user为“root”。
    insert into user(host,user) values('%','root');



  9. 上一步不起作用的话(登录MySQL之后):

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1234' WITH GRANT OPTION;



  10. 停止MySQL :service mysqld stop
  11. 再启动
  12. 备注:忘记密码
    service mysqld stop
    mysqld_safe --user=root --skip-grant-tables
    mysql -u root
    use mysql
    update user set password=password("new_pass") where user="root";
    flush privileges;



  13. 卸载MySQL

    yum --releasever=6 remove mysql*
    查看残留:whereis mysql
    删除mysql目录:rm –rf /usr/lib64/mysql
    删除相关文件:rm –rf /usr/my.cnf
                rm -rf /root/.mysql_sercret 
                rm -rf /var/lib/mysql



你可能感兴趣的:(yum 安装 mysql)