mysql命令行操作数据库
创建用户
1 | CREATE USER user1@127.0.0.1 IDENTIFIED WITH mysql_native_password BY '123456'; |
user1
用户名
127.0.0.1
允许的IP地址。 IPV6::1
远程 %
本地 localhost
、 127.0.0.1
mysql_native_password
加密方式。 旧的mysql_native_password
,新的caching_sha2_password
修改密码
1 | ALTER USER 'root'@'::1' IDENTIFIED WITH mysql_native_password BY '123456'; |
创建库
1 | CREATE DATABASE tablename CHARACTER SET utf8 -- UTF-8 Unicode COLLATE utf8_general_ci ; |
ubuntu安装mysql后报错
Lost connection to MySQL server at 'waiting for initial communication packet', system error: 0
修改配置文件增加skip-name-resolve
vi /etc/my.cnf
增加
1 | [mysqld] |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 张拓的博客!