Correct Command:
apt-get install libncurses*-dev

apt-get install libncurses*-dev
It’s finally solved after many hardships. Please refer to the notes of Niu Ren and record it
Install brew
First, install brew and Baidu. There are many tutorials
Install MySQL
#Install
brew install mysql
#Configure environment variables
echo'export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
#Make environment variables take effect
source ~/.bash_profile
#Start mysql service through script
mysql.server start
#Start mysql and set to boot
brew services start mysql
#Initialization, set password
mysql_secure_installation
ya..... bin% mysql_secure_installation
Enter password:
Securing the MySQL server deployment.
VALIDATE PASSWORD PLUGIN can be used to test passwords //Password verification plug-in, in order to improve security, you need to verify the password
and improve security. It checks the strength of password // It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin? //Prompt to install the password verification plugin
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy: //Three levels of password validation policy
LOW Length >= 8 //The minimum length is greater than or equal to 8 characters
MEDIUM Length >= 8, numeric, mixed case, and special characters //Numbers, letters, and special characters are mixed, the specific ones should be at least 1 number, 1 letter, 1 special character, and the length should not exceed 32 characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file // The most stringent, plus, the dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2 //Here I choose 2 MEDIUM
Using existing password for root.
Estimated strength of the password: 50 //Here is also the rating of password strength
Change the password for root ?((Press y|Y for Yes, any other key for No): y
New password: //Password
Re-enter new password:
Estimated strength of the password: 50
Do you wish to continue with the password provided? (Press y|Y for Yes, any other key for No): y //Prompt to use the password you just entered?
... Failed! Error: Your password does not satisfy the current policy requirements
New password: //Password
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No): y
By default, a MySQL installation has an anonymous user, //By default, MySQL has an anonymous user,
allowing anyone to log into MySQL without having to have //This anonymous user does not have to be created for them by a user. An anonymous user allows anyone to log into MySQL,
a user account created for them. This is intended only for //This is just to facilitate test use
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production //When using in a formal environment, it is recommended that you remove them
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No): y //Prompt to remove anonymous users
Success.
Normally, root should only be allowed to connect from //Under normal circumstances, root users are only allowed to log in using "localhost",
'localhost'. This ensures that someone cannot guess at // to ensure that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No): n //
... skipping.
By default, MySQL comes with a database named'test' that //By default, there is a test library in the MySQL database that can be accessed by any user.
anyone can access. This is also intended only for testing, //This is also intended only for testing
and should be removed before moving into a production // in a formal environment, should be removed
environment.
Remove test database and access to it?(Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes //Refresh the permission table to ensure that all modifications can take effect immediately
made so far will take effect immediately.
Reload privilege tables now?(Press y|Y for Yes, any other key for No) : y
Success.
All done!
Install mysql-connector-c
brew install mysql-connector-c
Installing Xcode-
xcode-select --install
Install OpenSSL
brew install openssl
After installation, the terminal will display the method of configuring environment variables
If you need to have openssl@3 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@3 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
Unlink MySQL and the linked MySQL connector mysql-connector-c
brew unlink mysql
brew link --overwrite mysql-connector-c
As shown in the figure, mysql-connector-c has a warning
warning: MySQL client is keg only and must be linked with -- force.
execute
brew link -- overwrite mysql-connector-c -- force
Install mysqlclient
Using PIP install mysqlclient
will not cause any errors
Connect MySQL again
Do the opposite of unlinking MySQL and the linked MySQL connector mysql-connector-c:
brew unlink mysql-connector-c
brew link --overwrite mysql --force
1. When executing mysqldump command for data backup, the error information is as follows:
~ % mysqldump -udbuser -p123456 -h127.0.0.1 school student > school_student.sql
mysqldump: Got error: 2002: "Can't connect to server on '127.0.0.1' (36)" when trying to connect
2. Then try the command line to connect to the database, which is also an error
~ % mysql -udbuser -p123456 -h127.0.0.1
ERROR 2002 (HY000): Can't connect to server on '127.0.0.1' (36)
3. After checking the MySQL service result, I remembered that I used ‘mysql. Server start’ to start the database. This cannot follow the system startup. Each time I restart the Mac, I need to run it manually. You can use brew services to start MariaDB Start the service with the system.
~ % mysql.server start
Starting MariaDB
.211111 16:04:44 mysqld_safe Logging to '/usr/local/var/mysql/xiaokang.err'.
211111 16:04:44 mysqld_safe Starting mariadbd daemon with databases from /usr/local/var/mysql
SUCCESS!
4. After successful restart, execute mysqldump again for backup
Problem description
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Solution
Option 1 Tomcat VM configuration parameters: – DJava. Net. Preferipv4stack = true
Option 2 ① Nginx configuring agent MySQL:
② Modify database connection: spring. Datasource. Url = JDBC: mysql://localhost:9999/demo?characterEncoding=utf8
Reference from:
https://blog.csdn.net/baidu_21349635/article/details/121032229
https://adong.blog.csdn.net/article/details/111501253
The MySQL table structure is as follows:
mysql> select * from fruits ;
+------+------+------------+---------+
| f_id | s_id | f_name | f_price |
+------+------+------------+---------+
| a1 | 101 | apple | 5.20 |
| a2 | 103 | apricot | 2.20 |
| b1 | 101 | blackberry | 10.20 |
| b2 | 104 | berry | 7.60 |
| b5 | 107 | xxxx | 3.60 |
| bs1 | 102 | orange | 11.20 |
| bs2 | 105 | melon | 8.20 |
| c0 | 101 | cherry | 3.20 |
| l2 | 104 | lemon | 6.40 |
| m1 | 106 | mango | 15.70 |
| m2 | 105 | xbabay | 2.60 |
| m3 | 105 | xxtt | 11.60 |
| o2 | 103 | coconut | 9.20 |
| t1 | 102 | banana | 10.30 |
| t2 | 102 | grape | 5.30 |
| t4 | 107 | xbababa | 3.60 |
+------+------+------------+---------+
According to s_ ID groups the table data, and the error message is as follows
mysql> select * from fruits group by s_id;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
'exercise.fruits.f_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible
with sql_mode=only_full_group_by
Query SQL_Mode mode
mysql> select @@session.sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@session.sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
Reason: only is added after MySQL 5.7_full_group_By roughly means that the column you select must be included in group by (for example, select a, B from table, group by a, B;), or you are an aggregate column, such as sum(), avg(), max(). The
official website says that SQL mode affects the syntax supported by MySQL and the data verification checks it performs, This makes it easier to use MySQL in different environments and other database servers
Official website reference link: https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-setting
Solution:
1. It is found that the set global setting in MySQL does not take effect and cannot be set under my.cnf
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
2. Query again is normal
mysql> select * from fruits group by s_id,f_name;
+------+------+------------+---------+
| f_id | s_id | f_name | f_price |
+------+------+------------+---------+
| a1 | 101 | apple | 5.20 |
| b1 | 101 | blackberry | 10.20 |
| c0 | 101 | cherry | 3.20 |
| t1 | 102 | banana | 10.30 |
| t2 | 102 | grape | 5.30 |
| bs1 | 102 | orange | 11.20 |
| a2 | 103 | apricot | 2.20 |
| o2 | 103 | coconut | 9.20 |
| b2 | 104 | berry | 7.60 |
| l2 | 104 | lemon | 6.40 |
| bs2 | 105 | melon | 8.20 |
| m2 | 105 | xbabay | 2.60 |
| m3 | 105 | xxtt | 11.60 |
| m1 | 106 | mango | 15.70 |
| t4 | 107 | xbababa | 3.60 |
| b5 | 107 | xxxx | 3.60 |
+------+------+------------+---------+
sql_Mode interpretation:
ONLY_FULL_GROUP_BY: For the GROUP BY aggregation operation, if the column in the SELECT is not in the GROUP
Appears in BY, then this SQL is illegal, because the column is not in the GROUP BY clause
NO_AUTO_VALUE_ON_ZERO: This value affects the insertion of self-growing columns. By default, inserting 0 or NULL means that the next self-increasing value is generated. If the user
Hope that the inserted value is 0, and the column is self-increasing, then this option is useful.
STRICT_TRANS_TABLES: In this mode, if a value cannot be inserted into a transaction table, the current operation is interrupted, and there is no restriction on non-transactional tables
NO_ZERO_IN_DATE: In strict mode, the date and month are not allowed to be zero
NO_ZERO_DATE: Set this value. The mysql database does not allow the insertion of a zero date. Inserting a zero date will throw an error instead of a warning.
ERROR_FOR_DIVISION_BY_ZERO: During INSERT or UPDATE, if the data is divided by zero, an error is generated instead of a warning. like
If the mode is not given, then MySQL returns NULL when the data is divided by zero
NO_AUTO_CREATE_USER: prohibit GRANT from creating users with empty passwords
NO_ENGINE_SUBSTITUTION:
If the required storage engine is disabled or not compiled, then an error is thrown. When this value is not set, replace with the default storage engine and throw an exception
PIPES_AS_CONCAT:
Treat "||" as a string concatenation operator instead of an OR operator, which is the same as the Oracle database and similar to the string concatenation function Concat
ANSI_QUOTES: When ANSI_QUOTES is enabled, double quotes cannot be used to quote a string because it is interpreted as an identifier
1. Background
A few days ago, a friend restarted the master database. The master-slave link was broken and “error_code 1045” was reported.
2. Solve
From the point of view of the error, it is because of a problem with the link authentication. You can compare whether the password is consistent with the password of the master_info file of the slave library. Most of them are caused by inconsistent passwords for some reason.
Solution:
stop slave;
change master to master_password='new_password';
start slave;
Error log
[root@mihaoyu151 conf]# schematool -dbType mysql -initSchema
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
21/11/09 14:25:20 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
21/11/09 14:25:20 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist
21/11/09 14:25:20 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist
Metastore connection URL: jdbc:mysql://192.168.133.151:3306/hive151?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
Starting metastore schema initialization to 1.1.0-cdh5.14.2
Initialization script hive-schema-1.1.0.mysql.sql
Error: Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
*** schemaTool failed ***
Error reporting reason
Hive database already exists in MySQL
Solution:
Delete hive database in MySQL
[root@mihaoyu151 soft]# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 135
Server version: 5.7.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| hive151 |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
mysql> drop database hive151;
Query OK, 54 rows affected (0.13 sec)
mysql> exit;
Bye
[root@mihaoyu151 soft]# schematool -dbType mysql -initSchema
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/opt/soft/jdk180/bin:/opt/soft/zookeeper345/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/jdk180/bin:/opt/soft/hadoop260/sbin:/opt/soft/hadoop260/bin:/opt/soft/zookeeper345/bin:/opt/soft/hive110/bin)
21/11/09 14:30:24 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
21/11/09 14:30:24 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.user does not exist
21/11/09 14:30:24 WARN conf.HiveConf: HiveConf of name hive.server2.thrift.client.password does not exist
Metastore connection URL: jdbc:mysql://192.168.133.151:3306/hive151?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
Starting metastore schema initialization to 1.1.0-cdh5.14.2
Initialization script hive-schema-1.1.0.mysql.sql
Initialization script completed
schemaTool completed
https://www.jianshu.com/p/6d8ed7c36e6f
368160;-net start mysql29616;- 38169;- 35823s;
error 2 has occurred. The system cannot find the file specified.
Solution:
run as an administrator and enter the installation path of CD + MySQL bin directory on the command line
C:\WINDOWS\system32>cd C:\softerwaresetting\mySQL\mysql-8.0.11-winx64\bin
C:\softerwaresetting\mySQL\mysql-8.0.11-winx64\bin>mysqld --remove
Service successfully removed.
C:\softerwaresetting\mySQL\mysql-8.0.11-winx64\bin>mysqld --install
Service successfully installed.
C:\softerwaresetting\mySQL\mysql-8.0.11-winx64\bin>net start mysql
The MySQL service is starting.
The MySQL service was started successfully.
When installing MySQL on Linux system, error: failed dependencies error occurs when installing services
I inquired about the solution on the Internet. There are so many dependencies that need to be installed. It is suggested to download them again. Personally, I think it is a waste of time. Another solution is to add -- nodeps -- force
, which is successfully solved
after the installation is completed, an error occurs again when starting the MySQL service
unfortunately, to run 32-bit programs on a 64 bit system, you need to install the 32-bit lib library. Or download a 64 bit version.
Pit stepping record – after Lombok is annotated with builder, mybatis cannot recognize the correct type of field
After adding Lombok to the entity class, sometimes we will use @ builder annotation, so we don’t need to write too many set methods to define the attribute content, which makes our code more elegant. Once the @ builder annotation is added to the entity class, it will cause problems in our mybatis mapping database fields
The questions are as follows
org.springframework.dao.DataIntegrityViolationException: Error attempting to get column 'username' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string 'zhangsa'
; Cannot determine value type from string 'zhangsa'; nested exception is java.sql.SQLDataException: Cannot determine value type from string 'zhangsa'
note: when using @ builder annotation, a full parameter structure will be generated, resulting in the disappearance of no parameter structure
terms of settlement
@ allargsconstructor
, @ noargsconstructor
) OL>
if it is still abnormal, you should check whether your entity class and database type mapping do not correspond
Hold fireworks to seek life, poetic to seek love