Category Archives: MYSQL

MongoDB Startup Error: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused

Mongodb login failed, report

2017-08-17T16:24:04.385+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2017-08-17T16:24:04.385+0800 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :

Such an error, and then fix it, and restart (Mongo’s path is modified by itself)

cd /usr/local/mongodb/bin
./mongod  --repair
mongod -f ../etc/mongodb.conf 

The following error was reported:

about to fork child process, waiting until server is ready for connections.
forked process: 20539
ERROR: child process failed, exited with error number 1

Solution:

Delete the lock and restart (the paths vary from person to person, but they are all under Mongo’s storage path (DB))

rm /data/mongo/db/mongod.lock

Then restart it

mongod -f ../etc/mongodb.conf 

It’s OK

[Solved] Failed to bind properties under ” to com.zaxxer.hikari.Hikari DataSource Spring Boot

Description:

Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

    Property: driverclassname
    Value: oracle.jdbc.OracleDriver
    Origin: "driverClassName" from property source "source" 
    Reason: Unable to set value for property driver- class - name

Action:

Update your application 's configuration

This error is because the h2 database is used by default in the springboot test environment, and you have not configured h2

I need to specify the mysql database I use

Add in application.properties

spring.datasource.driver- class -name=com.mysql.jdbc.Driver

When using SSH to log in to MySQL, Navicat reported an error: expected key exchange group packet from server

1、 Navicat SSH connection mode

Because the company uses alicloud’s RDS, it needs to connect to the database through the intranet (it does not provide direct public network access). At this time, you can use the SSH method of Navicat to connect to the RDS through a springboard machine

2、 Connection error and solution

Error: SSH: expected key exchange group packet from server

Solution:

1. Upgrade Navicat

2. Modifying the configuration of sshd

[root@Manager ~]#vim /etc/ssh/sshd_config  #Edit the sshd configuration file and add at the end
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1

 

[Solved] exp:EXP-00091 Exporting questionable statistics

For DBA or ordinary users who need to use exp,imp, we may often encounter EXP-00091 Exporting questionable statistics in the process of doing exp. The reason is that the NLS_LANG in the environment variable where our exp tool is located is not consistent with the NLS_CHARACTERSET in DB. But it should be noted that the error EXP-00091 has no effect on the generated dump file, and the generated dump file can still imp normally.

Let’s solve this problem so that it does not occur again.

Step 1.

Check the value of NLS_CHARACTERSET in DB (two methods are provided).

Query the value of NLS_CHARACTERSET

select * from nls_database_parameters t where t.parameter=’NLS_CHARACTERSET’
or
select * from v$nls_parameterswhere parameter=’NLS_CHARACTERSET’;

SQL> select * from v$nls_parameters where parameter=’NLS_CHARACTERSET’;

PARAMETER    VALUE
———————–  ———————————————-
NLS_CHARACTERSETZHT16BIG5

Step 2.

Set the environment variable for exp based on the NLS_CHARACTERSET (ZHT16BIG5) found in the first step.

 

WINNT>
set NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5 –windows environment

 

After setting, check the value of NLS_LANG in the environment variable to see if it is the same, if not, you can change it manually in the environment variable.

 

LINUX>
export NLS_LANG=AMERICAN_AMERICA.ZHT16BIG5 –linux environment

LINUX> exp export statement

 

Attached is the oracle error message for exp-00091 Solution Description.

error exp 91
00091, 00000, “Exporting questionable statistics.”
*Cause: Export was able export statistics, but the statistics may not be
usuable. The statistics are questionable because one or more of
the following happened during export: a row error occurred, client
character set or NCHARSET does not match with the server, a query
clause was specified on export, only certain partitions or
subpartitions were exported, or a fatal error occurred while
processing a table.
*Action: To export non-questionable statistics, change the client character
set or NCHARSET to match the server, export with no query clause,
export complete tables. If desired, import parameters can be
supplied so that only non-questionable statistics will be imported,
and all questionable statistics will be recalculated.

After installing mysql, centos7 can’t start the service, and prompts unit not found

Phenomenon:

Start MySQL database prompt:

Failed to start mysqld.service: Unit not found

MySQL is no longer supported in centos7. Even if you have installed it, centos7 still says it’s disgusting

 

 

Solutions

Maria dB, an open source version of MySQL

(Maria DB is like the shadow version of MySQL. Maria DB is a branch version of MySQL, not a folk version. The functions provided by Maria dB are fully compatible with MySQL.)

1. Installation:

yum install -y mariadb-server

2.start maria DB serves:

systemctl start mariadb.service

(Note: since CentOS 7. X, CentOS has started to use SYSTEMd service instead of daemon, and the original commands related to the start-up and management of system services are all replaced by systemctl commands.)

3. Add to boot auto start:

systemctl enable mariadb.service

Initialize database configuration

mysql_secure_installation

The first step is to set the password. You will be prompted to enter the password first

Set password

Enter current password for root (enter for none):<– Direct return

Set root password?[ Y/n] <– Whether to set the root password, enter y and press enter or press enter directly
new password: & lt; — Set the password of the root user
re enter new password: & lt; — Enter the password you set again
for other configurations

Remove anonymous users?[ Y/n] <– Do you want to delete anonymous users?Y enter

Disallow root login remotely?[ Y/n] <– Do you want to disable root remote login?N enter

Remove test database and access to it?[ Y/n] <– Delete test database, y enter

Reload privilege tables now?[ Y/n] <– Do you want to reload the permission table?Y enter

Complete the initialization of MariaDB, and then test the local login

Location of configuration file: VIM/etc/my.cnf.d/mysql-clients.cnf

Turn on remote access

Log in to the database locally and execute the following command:

First of all, configure the users who are allowed to access, and give the users permission in the way of authorization

GRANTALLPRIVILEGESON*.*TO'root'@'%'IDENTIFIEDBY'123456'WITHGRANTOPTION;

Finally, after configuring the permissions, you should not forget to refresh them to make them take effect. Note: root is the user who logs in to the database, 123456 is the password for logging in to the database, * means that any host from any source has great permissions anyway

flushprivileges;

[Solved] Centos7 Install MYSQL Error: Failed to start mariadb.service: Unit not found.

Solution:

First, you need to install MariaDB server

yum install -y mariadb-server

Start the service

systemctlstartmariadb.service

Add to boot

systemctlenablemariadb.service

Make some security settings, and modify the database administrator password

An error was reported when flash DB init was running, and the init DB command could not be found

flask init-db

The result is ` error: no such command “init DB”

That’s because init DB has been replaced by flash DB init

run flask db init error

The reason is that you can’t find the app.py file in your project, so you can’t confirm that your project is a flash project

I’m here because I renamed app. Py to manage. Py

Solutions

SQLALCHEMY_ DATABASE_ Uri and Sqlalchemy_ TRACK_ Modifications configuration error

Problem solving

The error report means, sqllchemy_ DATABASE_ Uri and Sqlalchemy_ TRACK_ Modifications both are required and cannot be omitted

You need to check whether there are these two items in the settings

If it is already set in the settings, please check whether the settings are before configuring the database. The order is very important

2. mysql 1366 VARIABLE_ VALUE incorrect

2. Problem solving

If the connection engine is not configured when configuring mysql, this error will be reported

The solution is as follows

Hive appears to refuse connection ConnectionRefused Solution

Caused by: java.net.ConnectException: Call From nn1.hadoop/192.168.10.6 to nn2. hadoop:9000 failed On connection exception: java.net.connectexception: refuse connection; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused

If you fail to connect to hive, you can refer to the official document if you report an error https://cwiki.apache.org/confluence/display/HADOOP2/ConnectionRefused

First check whether Hadoop is running normally, open the HDFS web page of Hadoop to browse whether the two nodes are running normally. A node may hang up or something, just start the node

Check whether the namenode is running normally, check whether the namenode is stable, and restart the zkfc service

Maybe MySQL hung up, just get up

[How to Solve] ImportError: No module named MySQLdb

When MySQL DB is introduced into Python scripts, errors are often reported. It’s not easy to install on MAC, windows and CentOS before. Here’s a summary. First, follow these basic dependencies:

sudo yum install mysql-devel gcc python-devel

// Install the Python development version and its headers
yum install python-devel.x86_64 (for python2)
sudo yum install python3-devel (for python3)

Then try

yum install MySQL-python -y

If it still fails, continue to install MSYQL

sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm#install mysql镜像
sudo yum install mysql mysql-server mysql-libs mysql-server#install mysql

Then install MySQL python

yum install MySQL-python -y

In addition, if it is Python 3, you may need to install the following:

pip3 install mysqlclient==1.3.7
pip3 install PyMySQL