mysql在使用過程當中,發現鏈接數超了~~~~node
[root@linux-node1 ~]# mysql -u glance -h 192.168.1.17 -p
Enter password:
ERROR 1040 (08004): Too many connectionsmysql
解決辦法,這也是centos7下修改mysql鏈接數的作法:
1)臨時修改
MariaDB [(none)]> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> set GLOBAL max_connections=1000;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.00 sec)linux
2)永久修改:
配置/etc/my.cnf
[mysqld]新添加一行以下參數:
max_connections=1000
重啓mariadb服務,再次查看mariadb數據庫最大鏈接數,能夠看到最大鏈接數是214,並不是咱們設置的1000。
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
這是因爲mariadb有默認打開文件數限制。能夠經過配置/usr/lib/systemd/system/mariadb.service來調大打開文件數目。sql
配置/usr/lib/systemd/system/mariadb.service
[Service]新添加兩行以下參數:
LimitNOFILE=10000
LimitNPROC=10000數據庫
從新加載系統服務,並重啓mariadb服務
systemctl --system daemon-reload
systemctl restart mariadb.servicecentos
再次查看mariadb數據庫最大鏈接數,能夠看到最大鏈接數已是1000
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+bash
=============================================================================
mysql設置32位md5值的密文密碼centos7
以下,設置admin用戶的密碼爲"123!@#ad" mysql> select * from admin_user; +----+----------+--------------------------------------------------------------------+----------------------+---------------------+ | id | username | password | create_time | update_time | +----+---------------+---------------------------------------------------------------+----------------------+---------------------+ | 1 | admin | 4ad597c11755c50d00457f4420365763 | 1538979880 | 1538979880 | +----+---------------+---------------------------------------------------------------+----------------------+---------------------+ 1 row in set (0.00 sec) mysql> update admin_user set username = 'admin',password = md5('123!@#ad') where id = 1 mysql> select * from admin_user; +----+----------+--------------------------------------------------------------------+----------------------+---------------------+ | id | username | password | create_time | update_time | +----+---------------+---------------------------------------------------------------+----------------------+---------------------+ | 1 | admin | 0fy866r8662a70d85632u90563212687 | 1541676212 | 1541676212 | +----+---------------+---------------------------------------------------------------+----------------------+---------------------+ 1 row in set (0.00 sec)