mysqld启动MYSQL服务 mysqld SQL后台程序(即MySQL服务器)。
要想使用客户端程序,该程序必须运行,因为客户端通过连接服务器来访问数据库。
## 检查机器是否安装了mysqlrpm -qa | grep mysql## 如果安装了,先进行协助rpm -e mysql ## 普通删除rpm -e --nodeps mysql ## 强力删除## 查看可安装版本yum list | grep mysql## 安装yum install -y mysql-server mysql mysql-devel# mysql 卸载rpm -qa | grep mysql # 查询有没有安装rpm -e mysql ## 普通删除rpm -e --nodeps mysql ## 强力删除find / -name mysql# 然后 删除对应文件 rm -rfrm /etc/my.con## 查看安装好的mysql-server的版本rpm -qi mysql-server## 启动数据库服务service mysqld start## 停止数据库服务service mysqld stop## 可以通过chkconfig --list | grep mysqld命令检测是否开机自动启动的chkconfig --list | grep mysqldmysqld 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭## chkconfig mysqld on 通过此命令让其开机自动启动chkconfig mysqld onchkconfig --list | grep mysqlmysqld 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭## 首次安装好后,是无密码的,通过下面命令设置root的密码/usr/bin/mysqladmin -u root password 'new-password' // 为root账号设置密码mysqladmin -u root password 'root'## /etc/my.cnf 是mysql的主要配置文件## /var/lib/mysql mysql数据库的数据库文件存放的位置## 通过下面命令创建一个数据库mysql> create database xiaoluo;## /var/log mysql数据库的日志输出存放位置## netstat -anp 命令来查看一下,Linux系统是否在监听 3306 这个端口号
mysql-server 没有的情况下如何通过yum安装
yum -y install wgetwget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpmrpm -ivh mysql-community-release-el7-5.noarch.rpmls -1 /etc/yum.repos.d/mysql-community*/etc/yum.repos.d/mysql-community.repo/etc/yum.repos.d/mysql-community-source.repoyum install mysql-server
mysql 8.0.21 版本修改密码alter user "root"@"localhost" identified by "new-password";
mysql 8的注意事项
vi /etc/my.cnf 加入 skip-grant-tables
# "/etc/my.cnf"# This group is read both both by the client and the server# use it for options that affect everything#[client-server]## include all files from the config directory#!includedir /etc/my.cnf.diskip-grant-tables
mysql -u root -p 然后无密码登录
