美文网首页
ubuntu搭建mysql服务

ubuntu搭建mysql服务

作者: Kosh | 来源:发表于2015-11-20 18:24 被阅读104次

安装

apt-get install mysql-server

配置

不区分大小写增加:

[mysqld]
lower_case_table_names  = 1

注释掉ip绑定,或者指定能访问的ip。

# bind-address = 127.0.0.1

授权用户能进行远程连接

执行如下命令登录mysql数据库:

mysql -u root -p

在sql命令行执行:

grant all privileges on *.* to root@"%" identified by "password" with grant option;
flush privileges;

第一行命令,“*.*”:第一个*代表数据库名;第二个*代表表名。所有数据库里的所有表都授权给用户。root:授予root账号。“%”:表示授权的用户IP可以指定,这里代表任意的IP地址都能访问Mysql数据库。“password”:分配账号对应的密码,这里密码自己替换成你的mysql root帐号密码。
第二行命令,刷新权限信息,让设置马上生效。

重启

service mysql restart

Access denied for user 'root'@'localhost' (using password: YES)

# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

相关文章

  • ubuntu搭建mysql服务

    安装 配置 不区分大小写增加: 注释掉ip绑定,或者指定能访问的ip。 授权用户能进行远程连接 执行如下命令登录m...

  • ubantu中php的安装与配置

    原文链接 1.开始说明 本文Ubuntu16.04下搭建Web服务器(MySQL+PHP+Apache)的内容很多...

  • MYSQL总结

    ubuntu启动mysql、停止mysql、重置mysql服务: sudo service mysql start...

  • mysql知识点

    ubuntu启动mysql、停止mysql、重置mysql服务: sudo service mysql start...

  • ecs + php + ubuntu

    1. 阿里云Ubuntu系统从0搭建LAMP(Apache+MySQL+PHP)以及服务器生产环境常用配置 2.a...

  • 阿里云ubuntu服务器安装mysql及配置教程

    参考:阿里云ECS服务器Ubuntu安装MySQL并远程访问阿里云服务器Ubuntu 16.04 3安装mysql

  • 被迫搭网站学习汇总

    操作系统 Apache PHP Mysql 环境搭建 20170829 Ubuntu14.04搭建LAMP2017...

  • MySQL8.0主从配置

    1 背景介绍 在ubuntu20.04上搭建MySQL8.0主从MySQL主机: 安装mysql8.0.23MyS...

  • ubuntu

    环境搭建 ubuntu18.04.1下快速搭建LNMP环境(PHP7.2.5+MySql5.7+Nginx1.14...

  • Ubuntu系统搭建Discus论坛

    介绍一下在Ubuntu系统下搭建Discus论坛 在搭建论坛之前,我们需要Ubuntu系统,mysql数据库,ph...

网友评论

      本文标题:ubuntu搭建mysql服务

      本文链接:https://www.haomeiwen.com/subject/vgilhttx.html