赞
踩
**
**
(1)安装mysql
apt-get update
apt-get install mysql-server
(2)设置mysql
service mysql stop
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
service mysql start
(3)查看用户名和密码
sudo cat /etc/mysql/debian.cnf
使用账户和密码登录:
mysql –h 127.0.0.1 –u debian-sys-maint –p
(4) 创建新用户并且授权
use mysql
mysql> create user ‘root’@‘%’ identified by ‘123456’;
mysql> grant all privileges on . to ‘root’@‘%’;
mysql> ALTER USER ‘root’@‘%’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
mysql> flush privileges;
(5)查看用户及权限
mysql> use mysql;
mysql> select host, user, authentication_string, plugin from user;
**
卸载命令:
sudo apt purge mysql-*
sudo rm -rf /etc/mysql/ /var/lib/mysql
sudo apt autoremove
sudo apt autoclean
遇到错误:
1、### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘ts.count’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
解决办法:登录mysql 执行命令:select @@global.sql_mode;
设置模式 set @@global.sql_mode=‘STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION’;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。