Using UTF8 encoded string in a MySQL query [closed] - mysql

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a UTF-8 (utf8mb4) mysql database.
For some reasons, I'd like to use utf8 encoded strings in my queries.
For instance, instead of using this query
Update mail_table set mail = 'john#foo.com'
I'd like to use:
Update mail_table set mail = SomeMySQLFunction('\x6A\x6F\x68\x6E\x40\x66\x6F\x6F\x2E\x63\x6F\x6D')
How may i do this? Cast? Convert?
Thanks.
Regards.

Use UNHEX() function.
UPDATE mail_table
SET mail = UNHEX('6A6F686E40666F6F2E636F6D')

Related

Clone mysql database replacing some fields with predefined or default values [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want to copy MySQL database while replacing some vulnerable data(e/g. email, phone, name, etc/) How can I efficiently achieve this?
The steps
dump your database
import your database
obfuscate values in your copy
remove your old dump
dump your second database
do whatever you need with the dump of the copy

Illegal mix of collations - MariaDB 10.4 - LUA [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
My lua codes for mysql
Getting these error
as the error message says, yellowpages_posts.realUser uses collation utf8mb4_unicode_ci and users.identifier uses utf8mb_general_ci.
you have to explicitly set the collation of one to the other, e.g.
yellowpages_posts.realUser = users.identifier COLLATE utf8mb4_unicode_ci
also checkout https://dev.mysql.com/doc/refman/8.0/en/cast-functions.html

How to delete data in MySQL from SQL Server? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have few tables in MySQL and I wanted to delete data in those MySQL tables from SQL Server. Do we have any approach to perform it?
You can perform Insert/Update/ Delete/ Select using Linked Server in the SQL Server. You just need to create MySQL LinkedServer and use Open Query.
Sample Query:
DELETE FROM OPENQUERY([MYSQL_LOCAL], 'SELECT user_id FROM d_portal.users' ) where user_id = 1;
MYSQL_LOCAL is a MySQL Linked Server.
You can follow the below Article for better guidance.
https://www.sqlshack.com/mysql-query-t-sql-tutorial-for-sql-server/

Is it possible to perform SQL injection on a server that is using a database other than MySQL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
If the database used by a server is something other than MySQL, say Mongo DB, then is it possible to execute SQL queries? In such cases how can we perform SQL injection?
I don't expect all the possible commands, but some basic commands if the app is using, say MongoDB.
Yes. This type of attack is possible with any data source which parses queries. In the case of MongoDB, the queries are written in JavaScript instead of SQL but if you build your query like this:
String query = "db.users.find({ age: " + request.getParameter("age") + " });"
then you open the database to similar kinds of attacks.
This is nosql injection, and it is possible.
https://www.owasp.org/index.php/Testing_for_NoSQL_injection

How to request a database schema via SQL query on popular SQL platforms? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Is there a SQL query that returns the schema of the current database? Like with columns "table", "name", "type", etc.
The platforms in question are MySQL, PostgreSQL, SQLite, and T-SQL.
The real RDBMS should all support an INFORMATION_SCHEMA set of views and tables. I think SQLite has its own take on things, but then it's a SQL library rather than a full RDBMS.
If you stick to the ANSI standard stuff your queries should be portable enough, but obviously you won't get details of the various platform-specfic features.
For MySQL, try SHOW TABLES; and DESCRIBE table_name;
For more info, check out http://dev.mysql.com/doc/refman/5.0/en/getting-information.html