Tag: development

How to add a ‘b’ prefix to a variable name in Python?

Strings with a ‘b’ prefix in Python Consider the following example: byte_string = b'test string' print(byte_string) These two strings will print: b'test string' Strings with a ‘b’ prefix are a sequence of bytes, i.e. a special type of data (such as strings, numbers, lists, etc.). Suppose we want to do something like this: variable_string = "test string" byte_string = b'variable_string'...

How to run a program from Python: how to run a system command or another Python script (complete guide)

Table of Contents 1. The subprocess module in Python 2. How to pass arguments to a program in subprocess.run 3. Getting the result of command execution (standard output, stdout)) 4. Working with the standard error (stderr) 5. Automatic command splitting into a list of arguments 6. How to run a command with wildcards 7. Calling a command without breaking it...

How to clear a List in Python. Why clearing a List deletes copies of it in other variables

Why clearing a List in Python deletes copies of it in other variables Clearing a list in Python can be done in a number of ways, some of which can lead to unexpected results if you don't know the differences and what's going on under the hood. Let's look at a very simple script that doesn't do anything meaningful, but...

How to download a file from a URL and save it on my server (how to avoid running out of RAM when downloading large files)

In PHP, you can download a file via a link (URL) and save it on your server in several ways. Some of them have important differences that can be key when choosing a way to download and save a file in PHP. 1. file_get_contents and file_put_contents The first very obvious option is to use file_get_contents and file_put_contents: file_put_contents("Tmpfile.zip", file_get_contents("http://someurl/file.zip")); Real...

How to create a new MySQL (MariaDB) user and configure its status and privileges

This note will show how to create a new MySQL (MariaDB) user, as well as configure its privileges (permissions) at the DBMS level as a whole, at the level of a particular database, and even at the level of individual tables and columns. Why create a new MySQL or MariaDB user Using root to perform Data Management Language (DML) operations...

How to allow a user to access only certain columns in MySQL (MariaDB)

Table of contents 1. How to set permissions on individual columns in MySQL (MariaDB) 2. How to allow the user to add entries to a column 3. How to allow the user to view entries in a column 4. How to allow the user to update records in a column 5. How to allow the user to create a foreign...

How to allow a user to access only certain tables in MySQL (MariaDB)

Table of contents 1. How to set permissions on individual tables in MySQL (MariaDB) 2. How to allow a user to create a specific table in a database 3. How to allow a user to delete a specific table in a database 4. How to allow a user to delete records in a table 5. How to allow a user...

How to allow a user to access only certain databases in MySQL (MariaDB)

Table of contents 1. How to set permissions on individual databases in MySQL (MariaDB) 2. How to allow a user to create tables in a database 3. How to allow a user to delete tables in a database 4. How to allow user to delete records in database tables 5. How to allow user to add records in database tables...

Error when using ‘USE’ statement in MySQL (Mariadb): “ERROR 1044 (42000): Access denied for user” (SOLVED)

Table of contents 1. The “USE” statement causes the error “ERROR 1044 (42000)” 2. How to fix MySQL (MariaDB) “ERROR 1044 (42000): Access denied for user” with USE statement 3. How to grant a user read access to a database and its contents 3.1 How to give a user read access to a specific database in MySQL (MariaDB) 3.2 How...

ERROR 1044 (42000): Access denied for user ‘mial’@’localhost’ to database ‘TestDB’. Can’t create MySQL database (SOLVED)

Why can't user create MySQL (MariaDB) database When trying to create a database, you may encounter an error: ERROR 1044 (42000): Access denied for user 'mial'@'localhost' to database 'TestDB' The reason for the error is that the specified user (username “mial” in this example) does not have the authority to create databases. The solution to the problem depends on the...
Loading...
X