Linux中MySQL怎么用

发布时间:2022-01-14 15:44:12 作者:小新
来源:亿速云 阅读:115

这篇文章将为大家详细讲解有关Linux中MySQL怎么用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

1.show databases;Linux中MySQL怎么用


2.use mysql转换databaseLinux中MySQL怎么用


3.show tables 显示数据库里的表Linux中MySQL怎么用


4.select user,host,password from user查询我的数据库mysql的user,host,passwordLinux中MySQL怎么用


5.给账号设置密码
mysql> update user set password=password('123456') where user='root';Linux中MySQL怎么用


6.清除空用户
delete From user where user='' ;Linux中MySQL怎么用


7.查看剩余用户
Linux中MySQL怎么用命令与上文相同的查询用户命令 

8.刷新权限(重点)
命令flush privileges;Linux中MySQL怎么用每次操作结束后都要刷新权限!!


9.通过用户进入数据库
mysql -u root -p123456; (-p后全是密码)Linux中MySQL怎么用



10.编辑.bash_profile文件(此步骤是为了可以让我们使用which mysql直接找到mysql文件在哪)
vi 。bash_profile修改为# .bash_profile
 

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin
                                     1,1           Top
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi


# User specific environment and startup programs

export MYSQL_BASE=/usr/local/mysql
export PATH=${MYSQL_BASE}/bin:$PATH

PS1=`uname -n`":"'$USER'":"'$PWD'":>"; export PS1得到结果Linux中MySQL怎么用


11.创建一个新的数据库并且设定可以进入他的机器
11.1 create database ruozedb;创建数据库ruozedb
11.2grant all privileges on ruozedb.* to ruoze@'192.168.137.252' identified by '123456'设定可以进入数据库ruozedb的用户只有IP为192.168.137.252的用户名叫做ruoze且密码为123456(如果把IP地址改为%则表示任意ID都可以用ruoze用户进入)
11.3flush privileges;权限刷新
实践如图:Linux中MySQL怎么用


12.连接Dbeaver

Linux中MySQL怎么用


关于“Linux中MySQL怎么用”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. MySQL中BINARY怎么用
  2. MySQL中Innobackupex怎么用

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

linux mysql

上一篇:OA软件和办公信息化Office区别是什么

下一篇:springboot整合quartz定时任务框架的方法是什么

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》