成都创新互联网站制作重庆分公司

Linux中MySQL怎么用

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

创新互联成立于2013年,我们提供高端成都网站建设成都网站制作成都网站设计、网站定制、网络营销推广微信平台小程序开发、微信公众号开发、网站推广服务,提供专业营销思路、内容策划、视觉设计、程序开发来完成项目落地,为iso认证企业提供源源不断的流量和订单咨询。

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怎么用”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


网站名称:Linux中MySQL怎么用
标题网址:http://cxhlcq.com/article/jdcgic.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部