标签:auth cal not sele nload cab shell connect load
工欲善其事,必先利其器。
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
sudo netstat -tap | grep mysql
出现了错误:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘问题
sudo mkdir -p /var/run/mysqld
sudo chown mysql /var/run/mysqld/
sudo service mysql restart
msyql
需要超级用户登录的问题在/etc/mysql/mysql.conf.d/mysqld.cnf
添加点内容,service mysql restart
,重新启动mysql
。
[mysqld]
skip-grant-tables
tar
安装https://dev.mysql.com/downloads/mysql/
mkdir mysql
tar -xvf mysql-server_5.7.30-1ubuntu18.04_amd64.deb-bundle.tar -C /opt/mysql
依赖下载libmecab2
:
依赖下载libaio1:
:
依次安装以下安装,否则会导致没有依赖而无法安装的情况
sudo dpkg -i libaio1_0.3.110-2_amd64.deb
sudo dpkg-preconfigure mysql-community-server_*.deb # 这一步需要设置密码
sudo dpkg -i mysql-common_*.deb
sudo dpkg -i mysql-community-client_*.deb
sudo dpkg -i mysql-client_*.deb
sudo dpkg -i libmecab2_0.996-1.2ubuntu1_amd64.deb # 依赖安装,之后才是server安装
sudo dpkg -i mysql-community-server_*.deb
-P
:端口(默认3306)-h
:ip地址-u
:用户名p
:密码mysql -uroot -proot -h 172.17.0.1 -P 12345
默认仅支持本地访问
mysql -uroot -p{密码}
mysql
数据库use mysql
mysql> select User,Host,authentication_string from user;
+---------------+-----------+-------------------------------------------+
| User | Host | authentication_string |
+---------------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
+---------------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;
*.*
:代表所有资源所有权限‘root‘@‘%‘
:其中root
代表账户名,%
代表所有的访问地址,也可以使用一个唯一的地址进行替换,只有一个地址能够访问。如果是某个网段的可以使用地址与%
结合的方式,如10.0.42.%。IDENTIFIED BY ‘root‘
:这个root
是指访问密码。WITH GRANT OPTION
允许级联授权。FLUSH PRIVILEGES;
mysql> select User,Host,authentication_string from user;
+---------------+-----------+-------------------------------------------+
| User | Host | authentication_string |
+---------------+-----------+-------------------------------------------+
| root | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| root | % | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+---------------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql
服务service mysql restart
service iptables status
service iptables stop
cd /etc/mysql/mysql.conf.d
sudo vim mysqld.cnf
# 注释bind-address = 127.0.0.1
操作完成之后即可远程登录。
标签:auth cal not sele nload cab shell connect load
原文地址:https://www.cnblogs.com/ydongy/p/13204246.html