Questions tagged as 'mysql'

1
answer

Revoke privileges

I have a database and I'm trying to make only my user have access to that database. or no one else can open, search, delete anything. I'm using the following syntax: GRANT USAGE ON batabase.* TO 'fabricio'@'%'; FLUSH PRIVILEGES; But nothi...
asked by 07.02.2015 / 12:18
1
answer

In which part of the application is it most appropriate to reorder an array (database, server application, client code)?

Let's suppose that in a MYSQL database query, I need to pick up the last 1000 data that was posted, but within those results, the order must be growing (not descending, as would happen in ORDER BY ID DESC Limit 1000 ). The response of...
asked by 16.10.2014 / 13:41
1
answer

Is it possible to create a decision structure in a table in SQL?

I have a massive database, it has more than 2,000 rows, and the second column has an ENUM that allows only 'Option 1' and 'Option 2'. If I enter 200 rows in the table and write the wrong ENUM name as an example insert into tabela values ('bla...
asked by 01.11.2014 / 13:41
1
answer

MySQL error 1153: Got a packet bigger than 'max_allowed_packet' bytes

When attempting to import a database from a dump with 1.2GB, the following error occurred:    ERROR 1153 (08S01) at line 727: Got a packet bigger than 'max_allowed_packet' bytes The command I'm using for import is: mysql -u usuario -p...
asked by 20.10.2014 / 22:04
1
answer

Root mysql user without permission

I'm having a problem changing user permissions in mysql with the root user, in Debian. I can usually access the terminal: $ mysql -u root -p So he asks me the root password, I put the password and normal access. However, when I try to ex...
asked by 20.08.2014 / 15:58
1
answer

Select that shows all tables that have fields with specific data type

I have a database that I need to change all the columns that are in FLOAT and DOUBLE to DECIMAL, are about 150 tables and I spend a lot of time looking one by one, is there any command that shows me this? MY SQL database, use 6.3 workbench...
asked by 21.07.2016 / 16:16
1
answer

Merge 2 different tables and display content by sorting by number of views (highest to lowest) of the two joins in MySQL

Considering that I have 2 tables in the DB, "news" and "news", each with its own fields: IsitpossibletomakeaSELECTinthetwotablesatthesametimesothatIgetthetop4valuesofthefields"impressions" (NEWS table) and "clicks" (NEWS table), the two comb...
asked by 30.12.2015 / 21:32
3
answers

Where should I place FK?

I am learning about database when a doubt arose. For example, I have two tables: user (_iduser, nome, sexo, ect.._) login (_idlogin, login, senha_)) You have 1:1 relationship. My question is precisely whether...
asked by 06.08.2015 / 09:01
5
answers

How to select the records that have relation with all the values of a list?

I have the following sql: SELECT DISTINCT cp_pessoa.id, cp_pessoa.nome FROM cp_pessoa LEFT JOIN cp_habilidade_freelancer ON (cp_habilidade_freelancer.id_freelancer = cp_pessoa.id) LEFT JOIN cp_habilidade ON (cp_habilidade.id = cp_habilidade...
asked by 10.02.2014 / 10:02
1
answer

How to do a select based on data from another table

I have to make the following adaptation in a query: Table app_usuários : id, nome, sobrenome, hash, sexo, interesse, latitude e longitude . Table app_likes : id, user_a_id, user_b_id Briefly, I have a query that...
asked by 28.08.2018 / 12:04