我是 mysql 的新手。我想使用我想要的任何 ip 连接到 mysql 服务器。我读到我所要做的就是将行 bind-address = 0.0.0.0 添加到 my.cnf 文件中。这就是我所做的。我重新启动了 mysql 服务器,然后从命令行对其进行了测试。
mysql -uroot -p'*password*' -h 127.0.0.1 --> Works
mysql -uroot -p'*password*' -h 192.168.2.4 (local ip address) --->
ERROR 1045 (28000): Access denied for user 'root'@'mguru.lnx.gr' (using password: YES)
Run Code Online (Sandbox Code Playgroud)
您可以在 my.cnf 文件中看到 mysqld 部分的以下部分
[mysqld]
user = mysql
port=3306
socket = /opt/lampp/var/mysql/mysql.sock
skip-external-locking
key_buffer = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M …Run Code Online (Sandbox Code Playgroud) 我希望找到、购买或编写脚本来识别慢查询、识别潜在的缺失索引,并在需要时在识别潜在索引的合理时间内创建适当的索引。任何人都知道这样做的产品或能力?
谢谢
我面临的基本问题是我需要每个项目的最新记录。
一些设置... MySQL 5.6.14。
我需要创建两个视图(因为 MySQL 不允许我在视图中有子查询)。我的第一个查询设置了这样的数据。
select
`inventoryrecords`.`inventoryrecordid` AS `inventoryrecordid`,
`inventoryrecords`.`logicaldeviceid` AS `logicaldeviceid`,
`inventoryrecords`.`passrfid` AS `passrfid`,
`inventoryrecords`.`tagepc` AS `tagepc`,
`inventoryrecords`.`currentstate` AS `currentstate`,
`inventoryrecords`.`statedateutc` AS `statedateutc`,
`inventoryrecords`.`ownerobjectid` AS `ownerobjectid`,
`inventoryrecords`.`ownerobjecttype` AS `ownerobjecttype`
from
`inventoryrecords`
where
1
order by `inventoryrecords`.`statedateutc` desc
Run Code Online (Sandbox Code Playgroud)
然后我可以使用我的“真实”查询将所有内容限制为每个 TagEPC 的最后一条记录。
select
`lastinventoryrecords_step1`.`inventoryrecordid` AS `inventoryrecordid`,
`lastinventoryrecords_step1`.`logicaldeviceid` AS `logicaldeviceid`,
`lastinventoryrecords_step1`.`passrfid` AS `passrfid`,
`lastinventoryrecords_step1`.`tagepc` AS `tagepc`,
`lastinventoryrecords_step1`.`currentstate` AS `currentstate`,
`lastinventoryrecords_step1`.`statedateutc` AS `statedateutc`,
`lastinventoryrecords_step1`.`ownerobjectid` AS `ownerobjectid`,
`lastinventoryrecords_step1`.`ownerobjecttype` AS `ownerobjecttype`
from
`lastinventoryrecords_step1`
group by `lastinventoryrecords_step1`.`tagepc`
order by `lastinventoryrecords_step1`.`statedateutc` desc
Run Code Online (Sandbox Code Playgroud)
当我尝试从“真实”视图中选择 * 时,我没有得到我期望的数据。但是,当我在窗口中使用子查询运行查询时。 …