Can we add MySQL Indexes without the server and client? - mysql

I was given access to a cluster today along with a front-end. The person who gave me access tells me I cannot start anything on the front-end and that I should submit everything as a job. Now I have no idea what that means but I'm thinking that I am not supposed to start MySQL on the front-end. If that is the case, how can I even use the database?
Is there a way I can add indexes without using the client-server? Or is it even possible to use a database in a cluster setup where I can only submit jobs?

I am guessing the person means that the client is actually executed as a "job". you might want to find out how they program the cluster.

Related

New user gets duplicated to all virtual hosts

Every time I add an user, it gets duplicated to all virtual hosts. I've been facing this issue for a while and found a way to solve it, see this post, it says I have to configure a separate database to each virtual host.
What I can't understand is why Ejabberd has this default behavior in first place, what is the benefit to do so?
And what about mod_mam? How do I configure it to store each message into its own database?
My ejabberd.yml (mod_mam configuration at line 113)
Thank you. :)
and found a way to solve it
Since recent ejabberd versions, you can use the new SQL schema, and configure ejabberd to use it, see in
https://docs.ejabberd.im/admin/configuration/#relational-databases
What I can't understand is why Ejabberd has this default behavior in
first place, what is the benefit to do so?
One possibility is the saved space for very big servers. Of course, when having many small servers, it's preferable to use one single database.
And what about mod_mam? How do I configure it to store each message
into its own database?
It's the same with this module than with the other ones: if you configure it to use 'sql' storage, and you configured ejabberd to use a certain database for host "example.net", and a different one for "example.com"..., then mod_mam will use the correct SQL database to store the MAM messages depending on the user that wants to store them.
Se the first and second example configs in section https://docs.ejabberd.im/admin/configuration/#virtual-hosting
On the other hand, if you use the new SQL schema, you only define one database, so those doubts do not appear.
[also asked in https://github.com/processone/ejabberd/issues/2752 ]

real-time mysql insert query using c

Good Day,
I am trying to learn on how to save my data in MySQL database using C in real-time.
I am using a Raspberry Pi MCU, and an external web server where the data will be saved. I am also using C to get the data from the sensors and would like to save it to my external database, but I do not know how to proceed with this problem as I am not that familiar with using C and MySQL together. though my main concern here is how do i make sure that my data is real-time, or when my sensors get the data it will then be saved to the database.
I'm thinking of doing an infinite loop inside my main and will place an if statement that will serve as a trigger whenever there is a data from the sensors and will save it to the mysql server.
but i am not sure if that is the most efficient way of doing this, that is why if you have any better ideas of how to retrieve my data in real-time using C and saving it to MySQL then it would be greatly appreciated.
in PHP i would have simply made a cron job for this but since i will be doing this in C, I am at lost on how to proceed or if my idea is correct.
You are looking at two independent problem:
Retrieve the data at a fixed interval
Save the data to a database.
For the first, there are two known methods, the first is polling which means stay in a while loop and constantly check if updates are available. The second method is using interrupts, you should choose the most appropriate for your problem but for beginning you can use the first method and when the program works (maybe) move it to interrupts.
For the second, just install MySQL and mysql C connector, just go to their site and download and install it. Its connection is pretty simple and there are a lot of examples online, both for combining and syntax.
An efficient way to do such things is called 'the hardware interrupt'. You should read the docs to check if the hardware supports it.

Trigger node.js when changes made in apache mysql

I'm building a simple commenting system using node and i need to configure this in a PHP project running in Apache server. So, i need to trigger node.js when some changes made in MySQL database table present in the Apache server. So, i need to know whether it is possible to do this in a Apache server? If so, then how to do that? Any idea or suggestions on this are greatly welcome. Please help...
I guess there are few options you could take, but I don't think you can get some sort of triggered action from within MySQL or Apache. IMHO, you these are the approaches you can take:
you can expose a HTTP API from node and every time you need to notify the node app, you could simply insert the data into MySQL using PHP and then issue a simple GET request to trigger node.
You could use some sort of queuing system (rabbitmq, redis, etc.) to manage the messages to and from the two application, hence orchestrating the flow of the data between the two apps (and later the db).
you could poll the database from node and check for new rows to be available. This is fairly inefficient and quite tricky, but it sounds more close to what you want.

Synchronizing SQLite and MySql together

I am trying to synchronize 2 different type of database together. Here is a better explanation of what I am trying to do:
I have the MySQL database on a server with the main database. I have an application installed on multiple computers.
I need the main database to be updated with the modification inside the computers and I need the computer version to get the updates from the main database.
I have seen the replication option in MySQL but it's not exactly what I want to do. I have seen other stuff like REPLACE INTO but I still don't see a clear solution.
I'm not asking for a full solution but maybe a good pseudocode or some cool functionality so I can try to implement it. This will be used on my end of school project.
I obviously have a timestamps on each row so I can detect changes.
This is how I would do this if I had an app that will run in different SQL environments.
It will be cleaner if you do the communication between yourApp & DB through some php class. This class instance will be created based on user's SQL version. Then, it is for your code in the class to decide how to connect to your DB.

creating a basic database

Right now, in my internship, I'm assigned to create a system that holds employee information such as personal info, education, salary, etc.
All these stuff is kept in a few spreadsheets right now. I need a basic program, but I feel like I should be using MySQL or another database solution to hold the data. I used MySQL before, but it was a PHP/MySQL assignment which I used Wampserver to create the whole system.
Edit: The system will be used by a few computers across the network. When someone makes a change to the system, it will become visible to other computers aswell. (obviously) (Before the edit, I thought that it's gonna be used by a single computer.)
I'm confused right now. Should I create a PHP/MySQL webpage with wampserver (or similar) to hold the information, or not?
Would it be easier or better to combine MySQL with some other programming language (such as Java/C++) and build a GUI? (I doubt it)
Should I come up with a different solution? Without database usage?
Database usage would be the best option. In the end it will come down to what you are more comfortable using, Java/C++ or php, for what you want to do either can work, but remember the database will need to be live at all times and using wamp server wont cut it. You need to learn how to tun a mysql server without wamp, which is easy(Google is awesome). And personally I would have used Java because Java is also easy to link with mysql, just google it a bit, and java doesn't need to run on a server so no wamp needed as you would have needed for php.
EDIT:
Ok if I understand you correctly what you want to do is the following:
1. Identify a pc to be used as a server and assign it a static IP.
2. This must also be the pc that is turned on first every day and turned of last.
3. Create a front end client application that connects to your sql server that you will be running on the server machine.
Now I am assuming this network is rather small, so you wont need a specific computer to just act as server. The server can also be one of the client machines.
The best approach would be to create a mysql server and make sure the firewall is not blocking your sql server. Then create a client application that can access the database over the network using Java, I find this easier than creating a php server for the users because of port forwarding for an apache server is time consuming, I did it once and never again. Java will be easiest to make the application work over the network. Use Netbeans for the development, it's an awesome IDE and it makes life easier when setting up the database connection.
If you have anymore questions please ask in comment, and I will elaborate, since this might be a bit vague lol.
Of course you should use a database for this type of work. That is the best way to organize, search, sort and filter your data without having to reinvent the wheel.
As to the other questions, the choice of language and environment is up to you to decide after evaluating the needs of your application.
Your solution should use a database to store the data and an front-end application to manage the data.
The database and front-end should be seen as two separate layers. In other words create the database using whatever database your are familiar with eg: MySQL and likewise create the front-end using whatever technology youre familiar with eg: PHP.
Personally for this type of requirement i would typically use MySQL / SQLExpress and ASP.Net / MVC3 front-end.
Hope this is helpful.